The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
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

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 05-06-2008
Registered User
 

Join Date: May 2008
Posts: 3
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.
Reply With Quote
Forum Sponsor
  #2  
Old 05-06-2008
 

Join Date: May 2008
Location: Sydney, Australia
Posts: 917
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`
Reply With Quote
  #3  
Old 05-08-2008
Registered User
 

Join Date: May 2008
Posts: 3
Thanks a lot. But giving ascii value does'nt work thats y I gave the delimeter directly.
Reply With Quote
  #4  
Old 05-08-2008
 

Join Date: May 2008
Location: Sydney, Australia
Posts: 917
It may not work with cut, but it does work with awk, at least for me.
Reply With Quote
  #5  
Old 06-17-2008
Registered User
 

Join Date: May 2008
Posts: 3
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.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 12:10 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0