I have this C shell (unfortunately C is required) script called EditFile.script
consisting entirely of 6 different sed commands, all to be applied to one text file.
#!/bin/csh -f
1i GameTime!!!!!!\n #append "GameTime!!!!!! at the beginning
s/pionts/points/g #sub typo
s/shot/shoot/g #sub typo
s/the\sthe/the/g #sub double the's with "the"
/^ *$/d #delete all blank lines
$a Game\nOver #append "Game Over" to the end of the file
Now the text file is 400+ lines long and I think posting it here (and its desired form) would be a waste of space.
However, when I run sed -f EditFile.script GameManual
at the cmdline all of the above commands work except for the final command. No
"Game Over" is appended to the end of the file. I believe it has something to do the with preceding "delete all blank lines /^ *$/d
command- because when I ran the script with it removed, "Game Over" was appended. But I don't see the connection.
Why will the final sed command in the script not show? Also, since this is my first time using a csh script (and c shell), what other additions must I make for the script to work?
sed
commands (executed withsed -f
), it's not really a "C shell script" and you can remove the#!/bin/csh -f
(which is just a comment as far assed
is concerned). Not sure if it makes a difference, but what (interactive) shell are you running thesed
command from?