Since I was downloading a couple of files that needed to be joined together, I thought that I would write a bash script to do this for me.
The file that I was getting was from a friend whom had created a home movie of his son walking but could not send the whole thing but had to send in parts, he used a program called HJSplit, but I wanted to join them together using just linux command line commands. So after doing that I have done a small bash script that will do a similar task for me every-time without needing to type in a few commands.
#!/bin/bash # Ian Porter : http://www.codingfriends.com # joining program, that will join files together similar to hjsplit. # get the input values input=$1 output=$2 # if input is equal to 2 parameters then if [ $# -eq 2 ] then # ls all of the files that meet the requirements of the 1st parameter for i in `ls $input*`; do echo "Adding file $i to $output" cat $i >> $output done else echo "input filename(s) | output filename" echo "..." echo "example arv arv.avi" echo "Please input the searchable filename and the output filename" fi |
If you save that as hj.sh and then change the execute writes on it
chmod 755 hj.sh |
This will allow you to run the program without typing in sh
./hj.sh files_to_join big_file |