[SGVLUG] awk question

Ramsin Savra ramsinsavra at yahoo.com
Wed Aug 30 12:02:16 PDT 2006


 
  Hi Tom,
   
  Do you mean that if I shift the parameter then it would work?
   
  Thanks,
  R
   
   
  

"Emerson, Tom" <Tom.Emerson at wbconsultant.com> wrote:
  -----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.



 		
---------------------------------
Do you Yahoo!?
 Get on board. You're invited to try the new Yahoo! Mail.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.sgvlug.net/pipermail/sgvlug/attachments/20060830/547e8187/attachment.html


More information about the SGVLUG mailing list