04-04-2008
1,
0
Join Date: Apr 2008
Last Activity: 16 April 2008, 4:34 AM EDT
Posts: 1
Thanks Given: 0
Thanked 0 Times in 0 Posts
Help!!!
Hi ya
I need some help please I am trying to read an input file and look for occurrences of the current user who is executing the script. On finding an occurrence of the username take that line and append it to a file and display a line number and a bracket against the saved line.
so far i created a file xx
with env sent to it 5 times
then i created this script but I only manged to get 1) next to each line that greped from the xx file which contained env 5 times: -
echo "Enter the file name to search username: "
read fileName
egrep -w "PWD" $fileName | head -1 | nl -ba -w1 -s\) >> test
egrep -w "USER" $fileName | head -1 | nl -ba -w1 -s\) >> test
egrep -w "MAIL" $fileName | head -1 | nl -ba -w1 -s\) >> test
egrep -w "LOGNAME" $fileName | head -1 | nl -ba -w1 -s\) >> test
egrep -w "HOME" $fileName | head -1 | nl -ba -w1 -s\) >> test
thanks in advance I have been racking my brains please help!!!!!