Computing.Net > Forums > Unix > Unix script

Unix script

Reply to Message Icon

Original Message
Name: octan3
Date: November 29, 2004 at 14:00:35 Pacific
Subject: Unix script
OS: win xp
CPU/Ram: 512
Comment:

hi,
i am writing a bash script and need some help.
i need to substring a variable containing grep


i have John Doe:999-999-9999 in a line.
the line is given by user input, which searches a file
and i need to print out the number part only and not the name.

i did
set A = `grep -i "$FN $LN"` datafile
// FN and LN are user inputs for the name
set N = `echo $A|awk '{print substr($0,12,12)}'`
echo $N

this case werks in the terminal but not when i put it in my bash script.


Report Offensive Message For Removal


Response Number 1
Name: cbailey33
Date: November 29, 2004 at 15:42:47 Pacific
Reply: (edit)

Something that works in a terminal, but not in a script usually means you need to set your path within the script. Try that first.


Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: Unix script

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software




Have you ever used OpenOffice?

Yes, as my main suite.
Yes, occationally.
Yes, but only once.
No, never.


View Results

Poll Finishes In 5 Days.
Discuss in The Lounge