![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Getting MAC from GPS unit | deaconf19 | Shell Programming and Scripting | 0 | 11-12-2007 10:56 PM |
| Add Delimeter, | Jairaj | Shell Programming and Scripting | 5 | 03-01-2007 11:19 PM |
| Delimeter used in data | hcclnoodles | Shell Programming and Scripting | 8 | 03-16-2006 05:26 AM |
| Awk Field Seperator Help | insania | Shell Programming and Scripting | 3 | 11-11-2005 01:29 AM |
| How do you represent a field delimeter that is a space??? | TRUEST | UNIX for Dummies Questions & Answers | 1 | 05-04-2003 06:01 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Handling Unit Seperator Delimeter
Hi,
We have a file with a unit seperator as the delimeter. Here are the Sample lines from the file: ASIA/PACIFICHong KongFX2007071080900 ASIA/PACIFICHong KongFX2007071080900/ 800129HK This delimeter has the ascii value of \037. I have to strip the second feild in this file for which i m using the cut command as follows: lines=`cat ibia.txt | cut -d "" -f2` and this works for me. But i just want to confirm if it is the correct way to proceed or should we try to do the same with Ascii value or is there any other better means of handling it. I tried with Ascii value and i get "bad delimeter". Please help. Thanks in advance, Sudha. |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
If it works, it's correct. :-)
However you may prefer to make it more readable, perhaps this: Code:
lines=`awk -F '\037' '{print $2}' ibia.txt`
|
|
#3
|
|||
|
|||
|
Thanks a lot. But giving ascii value does'nt work thats y I gave the delimeter directly.
|
|
#4
|
|||
|
|||
|
It may not work with cut, but it does work with awk, at least for me.
|
|
#5
|
|||
|
|||
|
Getting Fractional part in Division
Hi,
I have a simple code as follows: Percent_fail=`echo "scale=6; $Col_nm_cnt / $Line_cnt_lan" | bc` Though I get the answer correcly as follows, I also get an error msg along with it as follows: .333333 ./test.ksh[14]: .333333: unexpected `.' Can anyone please help me how to avoid this error message and why i get this message Thanks in advance, Sudha. |
|||
| Google The UNIX and Linux Forums |