grep is a powerful pattern matching utility:
#grep year7 /etc/passwd goes through the file /etc/passwd and looks for the string "year7" and prints it to "stdout" [i.e. standard output so other programs can process the info, or display on screen] The " | " is known as a pipe through - basically, run the program to the left and feed the output to the program on the right.
awk is like grep iirc, but more powerful. the -F: runs a program, and the stuff after that in the apostrophes is the program itself. It prints: mv /home/ The $1 indicates take the first field from the output line from the previous program and insert it here, so if your paswd file had "bob" as the first field, then it would print "mv /home/bob" :)
If you follow in the same vein for the rest of it, then you get: mv /home/firstfield /home/year7/firstfield
then the lot is "piped through" cat which just displays it to the screen [like "type" on dos/windows]
Hopefully I haven't confused you more :g:
Jon
Now THIS is what i like!!! A short description what the fix/scrip/sollution does. It helps us illiterates to understand whats going on. I usaly dont run unexplained/undocumented scripts unless i get a halfdecent understanding of what it does. The way Jon explained the script is exemplary!
VERY GOOD WORK!!
Rikard, I also replied to this with something similar but heaven knows where that mail is sitting now ... Only one correction... the -F: actully tells awk to use the : character as a field seperator (as opposed to a space character that we normally use). Awk is way more powerful than grep. Iif you can find out what the initials AWK stand for then that'll give you a clue why. Damian