about delimeter
|
Original Message
|
Name: nelsmy
Date: May 11, 2005 at 22:42:05 Pacific
Subject: about delimeterOS: Red hatCPU/Ram: Pentium 512 |
Comment: Dear all, Anyone can give me some direction on it? Here is my file content, aaaaa:bbbbb:ccccc:ddddd 11111:22222:33333333:444 zzzz:dddd:eee:eee how do i read each column into specific variable with delimeter ":"?? Here my script,anyone can give me some direction on it? #!/bin/bash while read v1 v2 v3 v4 do ....... done < text.txt
Report Offensive Message For Removal
|
|
Response Number 1
|
Name: teddybear63
Date: May 11, 2005 at 23:55:42 Pacific
Subject: about delimeter
|
Reply: (edit)hi, You can do like this: #!/bin/bash while read buf do v1=`echo $buf|cut -d: -f 1` v2=`echo $buf|cut -d: -f 2` ....... done < text.txt
Report Offensive Follow Up For Removal
|
|
Response Number 2
|
Name: nails
Date: May 12, 2005 at 04:26:46 Pacific
Subject: about delimeter |
Reply: (edit)Change the field separator, IFS: #!/bin/bash while IFS=":" read v1 v2 v3 v4 do printf "%s %s \n" $v1 $v2 done < text.txt
Report Offensive Follow Up For Removal
|
|
Response Number 4
|
Name: nelsmy
Date: May 12, 2005 at 17:22:15 Pacific
Subject: about delimeter |
Reply: (edit)Dear all, Really sorry to everyone about that actually this solution have been solved by nail and posted before, but i didn't search deeply so that this msg can be consider is a duplicate message! Thanks you to everyone who give a hand on it.
Report Offensive Follow Up For Removal
|
Use following form to reply to current message: