The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
piping from C to python in UNIX Dreams in Blue High Level Programming 0 05-04-2008 05:02 AM
Java with Unix (Redirection + Piping) fluke_perf High Level Programming 3 04-30-2008 08:52 AM
piping lnatz Shell Programming and Scripting 1 07-13-2006 11:30 PM
Help (Piping ls, tr, cut) scan Shell Programming and Scripting 2 02-11-2006 05:40 AM
redirecting/piping crashnburn UNIX for Advanced & Expert Users 3 03-25-2002 12:07 PM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 05-13-2007
Registered User
 

Join Date: May 2007
Posts: 3
Question Piping in UNIX

All,
I am a UNIX novice with a question that I hope you can help me with.
I have a UNIX application called "Tole" that formats and displays specific information about customers. I can display the information for up to 30 customers by seperating customer IDs using commas in this format:
Tole -c 10,20,30... I would like to have the application pull the values shown after the -c argument from a .csv file (say customers.csv) and run them in groups of 30. Also, I would like the output piped and appended to a results file (say results.csv) as in: Tole -c 10,20,30 >> results.csv.
Thank you in advance for your help.
Adam
Reply With Quote
Forum Sponsor
  #2  
Old 05-14-2007
...@...
 

Join Date: Feb 2004
Location: NM
Posts: 4,275
Code:
#!/bin/ksh
awk -F, '{ for(i=1; i< NF; i++) 
               if(i%30 == 0 ) {printf("%s\n", $i) }
               else  {printf("%s,",$i) } 
             END {print "" }
           ' | \
while read parms
do
      Tole -c "$parms" 
done >> result.csv
Reply With Quote
  #3  
Old 05-17-2007
Registered User
 

Join Date: May 2007
Posts: 3
Piping in UNIX

Thank you Jim. Can you take me through this command and let me know what directory this needs to go under?
Regards,
Adam
Reply With Quote
  #4  
Old 05-22-2007
Registered User
 

Join Date: May 2007
Posts: 3
Piping in UNIX

Quote:
Originally Posted by jim mcnamara
Code:
#!/bin/ksh
awk -F, '{ for(i=1; i< NF; i++) 
               if(i%30 == 0 ) {printf("%s\n", $i) }
               else  {printf("%s,",$i) } 
             END {print "" }
           ' | \
while read parms
do
      Tole -c "$parms" 
done >> result.csv

Can someone tell me if I need to be logged in as root and explain what the commands mean?
Thank you,
Adam
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 12:20 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