By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
462,378 Members | 537 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 462,378 IT Pros & Developers. It's quick & easy.

Shell script quoting and line read line

P: 20
Hi all,

I am in the progress of consolidating my 2 NIS databases into 1. My first step is to get the NIS record for particular department. I have software.csv which contain list of name in.

John Travolta
Elthon John
Sean King Ston
Taylor Swif t
Nicole cage

I create a simple script to read from software.csv , called

Expand|Select|Wrap|Line Numbers
  1. #!/bin/sh
  2. list_source="software.csv"
  3. cat $list_source | while read LINE; do
  4. N=$((N=1))
  5. echo '"${LINE}"'
  6. ypcat passwd | grep \"$LINE\"
  7. done
My output is:
John Travolta
grep: Travolta": No such file or directory
Elthon John
grep: John": No such file or directory
Sean King Ston
grep: King: No such file or directory
grep: Ston": No such file or directory
Taylor Swif t
grep: Swif: No such file or directory
grep: t": No such file or directory

I tried with many way to play around with my second last line but still not able to resolve.

Can anyone please help me in this case? Your help is appreciated!
Nov 12 '09 #1
Share this Question
Share on Google+
1 Reply

P: 14
Can you put an example of what your want your output to look like? How big is your software.csv file? Do you have to write this in sh or is perl an option?
Nov 14 '09 #2

Post your reply

Sign in to post your reply or Sign up for a free account.