This is for our weekly prac, no marking or grade (we don't even get the answers!)
I'd really appreciate it if anyone has the time to help explain this exercise to me, as I'm trying to get this work done over the weekend and won't be able to get assistance from my tutor until next week. I've been doing a lot of reading and work covering bash programming, regex and grep. But the code below has just got me flummoxed.
I'm even wondering, are the instructions incomplete or am I just not getting it?
Specifically the following are preventing me from understanding the entire thing:
NAMES=`ls *.$1`
filed=$(file:$1).$2
Exercise 4.3
Suppose you are given a text file (called myfile) containing the following
#!/bin/bash
NAMES=`ls *.$1`
for file in $NAMES; do
filed=$(file%:$1).$2
mv file filed
done
Execute the following commands $ grep ' file ' myfile
$ grep 'file*' myfile
$ grep '^ *file*' myfile
$ grep 'file$' myfile
$ sed 's/ file* / script /g' myfile
$ sed ' /for/,/files/d' myfile
$ sed '/\$[A-Z]..[A-Z]*/d' myfile
Then explain the output or results