|
Home > Archive > Unix Shell > May 2007 > Question on script - PLEASE HELP!!!
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Question on script - PLEASE HELP!!!
|
|
| jdoe987@gmail.com 2007-05-24, 7:18 pm |
| I have a file with multiple columns of info. I would like to separate
each column per host - for example
foobar 1234 abcd 9876
fobar2 vvvvv aaaaa 1111
I want to write a script that will read each colume and write the
contents into a file. I have gotten this work if each entry is in a
separat file but not when it is in one large file
cat testfile| while read name field1 field2 field3 field4 ; do echo
Field1=$name; echo Field2=$site; echo Field3=$cad; echo Field4=
$serial;done
I tried adding rsh to this and having the contects written locally to
each host but it is not working. Any help?
| |
|
| sounds like something awk can do.. can you clarify on what you wanna
do?
On May 24, 9:50 pm, jdoe...@gmail.com wrote:
> I have a file with multiple columns of info. I would like to separate
> each column per host - for example
>
> foobar 1234 abcd 9876
> fobar2 vvvvv aaaaa 1111
>
> I want to write a script that will read each colume and write the
> contents into a file. I have gotten this work if each entry is in a
> separat file but not when it is in one large file
>
> cat testfile| while read name field1 field2 field3 field4 ; do echo
> Field1=$name; echo Field2=$site; echo Field3=$cad; echo Field4=
> $serial;done
>
> I tried adding rsh to this and having the contects written locally to
> each host but it is not working. Any help?
| |
| Barry Margolin 2007-05-24, 7:18 pm |
| In article <1180039803.615018.127820@q75g2000hsh.googlegroups.com>,
jdoe987@gmail.com wrote:
> I have a file with multiple columns of info. I would like to separate
> each column per host - for example
>
> foobar 1234 abcd 9876
> fobar2 vvvvv aaaaa 1111
>
> I want to write a script that will read each colume and write the
> contents into a file. I have gotten this work if each entry is in a
> separat file but not when it is in one large file
>
> cat testfile| while read name field1 field2 field3 field4 ; do echo
> Field1=$name; echo Field2=$site; echo Field3=$cad; echo Field4=
> $serial;done
This makes no sense. Where do $site, $cad, and $serial come from? Did
you mean to use those variable names in the read command, instead of
field1, field2, etc.?
>
> I tried adding rsh to this and having the contects written locally to
> each host but it is not working. Any help?
Where are hostnames in this?
--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***
| |
| Thobias Vakayil 2007-05-28, 1:19 am |
| jdoe987@gmail.com wrote:
>I have a file with multiple columns of info. I would like to separate
>each column per host - for example
>
>foobar 1234 abcd 9876
>fobar2 vvvvv aaaaa 1111
>
>I want to write a script that will read each colume and write the
>contents into a file. I have gotten this work if each entry is in a
>separat file but not when it is in one large file
>
>cat testfile| while read name field1 field2 field3 field4 ; do echo
>Field1=$name; echo Field2=$site; echo Field3=$cad; echo Field4=
>$serial;done
>
>I tried adding rsh to this and having the contects written locally to
>each host but it is not working. Any help?
>
>
>
cat testfile | awk '{print $1}
--
Thobias Vakayil
Alcatel Development India (ADI)
PH: 2349961/72/86 EXTN :7018
| |
| mik3l3374@gmail.com 2007-05-28, 7:19 am |
| On May 28, 11:41 am, Thobias Vakayil <Vakayil.Thob...@alcatel.com>
wrote:
> jdoe...@gmail.com wrote:
>
>
>
>
>
> cat testfile | awk '{print $1}
>
> --
> Thobias Vakayil
> Alcatel Development India (ADI)
> PH: 2349961/72/86 EXTN :7018
UUOC
awk '{<awk statements>}' testfile
|
|
|
|
|