Putting commands in a file
Put these lines in a script file named script.sed.
4i\ s/,/\t\t/ s/,/ /
Then run it like this:
$ sed -i -f script.sed baconFile
Making a standalone sed script
if you want it to be a single executable then do this:
#/bin/bash sed -i ' 4i\ s/,/\t\t/ s/,/ / ' "$@"
Put the above lines into a file called script.bash, make it executable (chmod +x script.bash, and run it like this:
$ script.bash baconFile
Creating the script file
You can use this method to make the file I mentioned above.
$ cat > script.bash <<EOF #!/bin/bash 4i\ s/,/\t\t/ s/,/ / EOF
This will make the script file. You can confirm using this command:
$ cat script.bash #!/bin/bash 4i\ s/,/\t\t/ s/,/ /