|
|
|
|
||||||
| comp.unix.shell Using and programming the Unix shell. |
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
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 ? |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
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 ? |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
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 ? 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 *** |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
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 ? > > > cat testfile | awk '{print $1} -- Thobias Vakayil Alcatel Development India (ADI) PH: 2349961/72/86 EXTN :7018 |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
On May 28, 11:41 am, Thobias Vakayil <Vakayil.Thob...@alcatel.com>
wrote: > 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 ? > > cat testfile | awk '{print $1} > > -- > Thobias Vakayil > Alcatel Development India (ADI) > PH: 2349961/72/86 EXTN :7018 UUOC awk '{<awk statements>}' testfile |
|
![]() |
| Outils de la discussion | |
|
|