The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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 and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Testing For Loop condition mavsman UNIX for Dummies Questions & Answers 4 04-01-2008 11:45 AM
Checking condition inside the loop ithirak17 Shell Programming and Scripting 1 03-13-2008 08:37 AM
What condition to be put in the while loop? nehaquick UNIX for Dummies Questions & Answers 1 02-15-2008 04:06 PM
End of loop condition required??? skyineyes Shell Programming and Scripting 4 07-16-2007 03:10 AM
how to get the similar function in while loop or for loop trynew Shell Programming and Scripting 3 06-17-2002 11:09 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 04-27-2008
mail2sant mail2sant is offline
Registered User
  
 

Join Date: Apr 2008
Location: bangalore
Posts: 67
how can i put the condition in for loop for the below.

i have the equation like below

07:35:07 ( AB : 2319f.ab * 22) + ( AB : 2320f.ab * 22.03 ) + ( AB :2321f.ab * 22.07 ) ...... N

i want put ":" as a delimiter and break the equation like below


2319f.ab * 22
2320f.ab *22.03
2321f.ab * 22.07
.
.
N

i know the number of coulmn for Eg 12 then i can user
for (( i=5;i<12;i++ ))

do

cat $1 | cut -d ":" -f"$i" >> a1
done


but for N number of .. how can i cut for the above ?
  #2 (permalink)  
Old 04-28-2008
Ygor's Avatar
Ygor Ygor is online now Forum Staff  
Moderator
  
 

Join Date: Oct 2003
Location: -31.96,115.84
Posts: 1,402
Try...
Code:
$ echo '07:35:07 ( AB : 2319f.ab * 22) + ( AB : 2320f.ab * 22.03 ) + ( AB :2321f.ab * 22.07 ) ...... N' |\
> awk 'BEGIN{FS=":|\\(";RS=")"}{print $NF}'
 2319f.ab * 22
 2320f.ab * 22.03
2321f.ab * 22.07
 ...... N
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 09:49 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0