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
tell me whats wrong with this nadman123 Shell Programming and Scripting 1 04-14-2008 08:58 PM
tell me whats wrong in this? nadman123 Shell Programming and Scripting 1 04-09-2008 10:11 PM
if [ -s $File ] ; Whats wrong in this ?? varungupta UNIX for Advanced & Expert Users 5 08-20-2007 10:24 PM
Whats wrong with this script? kayarsenal Shell Programming and Scripting 2 08-25-2006 06:58 AM
Whats wrong with the mv command dsravan Shell Programming and Scripting 0 08-10-2006 12:30 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 03-31-2006
Registered User
 

Join Date: Mar 2006
Posts: 16
whats wrong with this awk???

while read LINE;
do
echo |awk -v LIN="${LINE}" '{print substr(LIN,1,7)","substr(LIN,8,5)" ,"substr(LIN,14,10)","substr(LIN,24,6)" ,"substr(LIN,30,8)}';
done < exp1.txt


exp1.txt = 1234 grgrg 203902 ksdjh oehr weo

why it doesn't work??

thanks.
Reply With Quote
Forum Sponsor
  #2  
Old 03-31-2006
Klashxx's Avatar
HP-UX/Linux/Oracle
 

Join Date: Feb 2006
Location: Almerķa, Spain
Posts: 383
Could you post the output ?

I get the right thing:

1234 gr,grg 2 ,3902 ksdjh, oehr ,weo
Reply With Quote
  #3  
Old 03-31-2006
Registered User
 

Join Date: Mar 2006
Posts: 16
I did a mistake

thanks for your reply
Reply With Quote
  #4  
Old 04-04-2006
Registered User
 

Join Date: Mar 2006
Posts: 16
what removed is going on????????

while read LINE;
do
echo LINE |awk -v LIN="${LINE}" '{print substr(LIN,1,7)","substr(LIN,8,5)","substr(LIN,14,10)","substr(LIN,24,6)","substr(LIN,30,8)","substr (LIN,38,4)}';
done < prefinal.txt

prefinal.txt:
1234 grgrg 203902 ksdjh oehr weo


why it doesn't work????????

removed cygwin

Last edited by Perderabo; 04-04-2006 at 06:32 AM. Reason: Remove profanity
Reply With Quote
  #5  
Old 04-04-2006
vino's Avatar
Supporter (in vino veritas)
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,695
Quote:
Originally Posted by george_
what a removed is going on????????

while read LINE;
do
echo LINE |awk -v LIN="${LINE}" '{print substr(LIN,1,7)","substr(LIN,8,5)","substr(LIN,14,10)","substr(LIN,24,6)","substr(LIN,30,8)","substr (LIN,38,4)}';
done < prefinal.txt

prefinal.txt:
1234 grgrg 203902 ksdjh oehr weo


why it doesn't work????????

removed cygwin
You broke the very first rule of the forum.

(1) No flames, shouting (all caps), sarcasm, bullying, profanity or arrogant posts.

Please adhere to the rules.
Reply With Quote
  #6  
Old 04-04-2006
Registered User
 

Join Date: Mar 2006
Posts: 16
I am sorry,I didn't know about it...
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 03:43 AM.


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