[SGVLUG] awk question

Emerson, Tom Tom.Emerson at wbconsultant.com
Wed Aug 30 11:53:45 PDT 2006


-----Original Message----- Of Ramsin Savra
> Sure. I have a CSV file and I need to extract two first columns.[...]
> In command line I do:
>
> cut -f 2  file1.tmp | grep "DB" | awk ' {print $0} ' [...]
>
> then tables_list file has:
>
> "4","STUDENT TABLE"
> "5","TEACHER TABLE"
>
> Then I use sed command to remove double quotes and ...
>
> Now. when I use awk is my script instead of replacing $0 with a
> line from the text file it replaces it with script name. I need
> to override this.
>
> Any suggestions?

Shift

$man shift
[bash builtins...]
  shift [n]
        The  positional  parameters  from  n+1 ... are renamed to $1
....
        Parameters represented by the numbers $# down to $#-n+1 are
unset.
        n must be a non-negative number less than or equal to $#.  If n
is
        0, no parame-ters  are  changed.   If  n  is  not given, it is
        assumed to be 1.  If n is greater than $#, the positional
        parameters are not changed.  The return status is greater than
        zero if n is greater than $#  or  less  than zero; otherwise 0.



More information about the SGVLUG mailing list