Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Turning some "," into "/"

Status
Not open for further replies.

Guest_imported

New member
Joined
Jan 1, 1970
Messages
0
Hello,

Does anybody know how to solve the following? This output (5 lines):

If,IN,number,NN,description,NN,of,IN,number,NN,is,VBZ,in,IN,0
tabs,NNS,at,IN,top,NN,of,IN,window,NN,=,=,=,=,0
form,NN,name,NN,part,NN,of,IN,Internet,NN,address,NN,of,IN,0
structured,VBN,thatis,NN,part,NN,of,IN,is,VBZ,part,NN,=,=,0
list,NN,follow,VB,instructions,NNS,of,IN,Find,VB,Setup,NNP,Wizard,NNP,0

should become:

If/IN number/NN description/NN of/IN number/NN is/VBZ in/IN 0
tabs/NNS at/IN top/NN of/window/NN =/= =/= 0
form/NN name/NN part/NN of/IN Internet/NN address/NN of/IN 0
structured/VBN thatis/NN part/NN of/IN is/VBZ part/NN =/= 0
list/NN follow/VB instructions/NNS of/IN Find/VB Setup/NNP Wizard/NNP 0

As a beginner, it's too complicated for me (or maybe just too late in the evening). Anyway, help is much appreciated!
Thanks.

 
BEGIN {
FS=",";
NFS="/";
OFS=" ";
}

{
for(i=1; i < NF; i++)
printf(&quot;%s%s&quot;, $i, (i % 2) ? NFS : OFS);

printf(&quot;%s\n&quot;, $NF);
}
 
cat $file | tr &quot;,&quot; &quot;/&quot;

$file would be the filename that has the five lines listed above

crowe
 
pay more attention to the sample file, PLS!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top