PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Serveur - Sécurité et techniques > comp.unix.shell > Question on script - PLEASE !!!
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
comp.unix.shell Using and programming the Unix shell.

Question on script - PLEASE !!!

Réponse
 
LinkBack Outils de la discussion
Vieux 24/05/2007, 21h50   #1
jdoe987@gmail.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Question on script - PLEASE !!!

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 ?

  Réponse avec citation
Vieux 24/05/2007, 23h23   #2
Ben
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Question on script - PLEASE !!!

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 ?



  Réponse avec citation
Vieux 25/05/2007, 00h57   #3
Barry Margolin
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Question on script - PLEASE !!!

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 ***
  Réponse avec citation
Vieux 28/05/2007, 04h41   #4
Thobias Vakayil
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Question on script - PLEASE !!!

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
  Réponse avec citation
Vieux 28/05/2007, 09h08   #5
mik3l3374@gmail.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Question on script - PLEASE !!!

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

  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 22h35.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,11686 seconds with 13 queries