Essentially, I'm given a text file and am supposed to screw with it via sed commands. I have about 7 sed commands total and need to put them all in one shell script to produce ONE output when this script is run.
Text file to be screwed with: students.txt
Students.txt:
DogG DOGGGGGGGG
dog dog dog Jamesb
JamesBrady
derghnregnrig
JamesBeody
So the first sed gets rid of first and last line. second sed replaces dog with DOGGGG third sed finds and prints all lines w/JamesBrady fourth sed finds and prints all lines with derghnregnrig
Sed Commands (BS Examples):
sed -e '1d' -e '$d' -e '/^$/d' students.txt
sed -n s/dog/DOGGGG/g students.txt
sed -n /JamesBrady/p students.txt
sed -n /derghnregnrig/p students.txt
The above sed commands are all to go in one shell script file, and when run are supposed to output its (cumulative?) effects on one text file (students.txt)
So far, I've tried to look up the correct procedure for doing this and have met nothing but confusion. Can someone explain in clarity and with a beginner's patience how multiple sed commands, and any commmands (awk, grep, etc.) for that matter, are supposed to fit inside a single shell script file?
Using Ubuntu 16.04, Vim. Bash shell
students.txt
, and your desired output from that.