Shell script quoting and line read line

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • DannyMc
    New Member
    • Aug 2007
    • 20

    Shell script quoting and line read line

    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.

    software.csv:
    John Travolta
    Elthon John
    Sean King Ston
    Taylor Swif t
    Nicole cage
    .......

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

    Code:
    #!/bin/sh
    list_source="software.csv"
    cat $list_source | while read LINE; do
    N=$((N=1))
    echo '"${LINE}"'
    ypcat passwd | grep \"$LINE\"
    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!
  • jsmithstl
    New Member
    • Jun 2007
    • 14

    #2
    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?

    Comment

    Working...