Unix script question (basic)

From: Piestiany7 (piestiany7_at_aol.com)
Date: 03/05/04


Date: 05 Mar 2004 18:44:12 GMT

Some time ago on these boards someone suggested a good
way of finding out how many columns there were in a file

read x < $1
set -- $x
columns=$#

I have two questions

1) what effect is set -- $x having (ie in enabling subsequently for $# to have
meaning)

2) if we were to put this into a loop to read every single row in the file and
output the number of columns, can we use a construct like
<command> | while read row

if so what can we have for 'command'? cat looks at a field at a time

thanks.



Relevant Pages

  • Re: Unix script question (basic)
    ... set sets positional paramenters. ... > 2) if we were to put this into a loop to read every single row in the file and ... cat does nothing on the file contents. ...
    (comp.unix.questions)
  • Re: extra index scans on update
    ... Perhaps datatype of colx and x are different. ... Only a single row is updated for each ... > If I run the same command again, it works much faster because there are ... When I run the same command again, the row is in the cache and things ...
    (microsoft.public.sqlserver.programming)
  • Reversing Dates on First Insert in DataEnvironment and VB6
    ... I am using a Command to INSERT a single row INTO an Access table. ... Date/Time fields are causing me grief by reversing the Day and Month - but ... Dim dtEnd As Date ...
    (microsoft.public.vstudio.development)
  • Re: What is the Visual Basic command to select an entire row in Excel.
    ... Where Range is a cell address on the row you want to select. ... > single row in an Excel spreadsheet it selects all the rows in the ... Is there another command that will select a single row?? ...
    (microsoft.public.excel.programming)
  • Re: What is the Visual Basic command to select an entire row in Excel.
    ... You can use this for the activecell row ... > When I use the command Rows.EntireRow.Select in Visual Basic to select a> single row in an Excel spreadsheet it selects all the rows in the ... Is there another command that will select a single row?? ...
    (microsoft.public.excel.programming)