Piping in UNIX | Unix Linux Forums | UNIX for Dummies Questions & Answers

  Go Back    


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 !!

Piping in UNIX

UNIX for Dummies Questions & Answers


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 05-13-2007
simo007 simo007 is offline
Registered User
 
Join Date: May 2007
Last Activity: 23 May 2007, 2:41 AM EDT
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
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
Sponsored Links
    #2  
Old 05-14-2007
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
 
Join Date: Feb 2004
Last Activity: 2 September 2014, 4:09 PM EDT
Location: NM
Posts: 10,188
Thanks: 275
Thanked 785 Times in 734 Posts

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

Sponsored Links
    #3  
Old 05-17-2007
simo007 simo007 is offline
Registered User
 
Join Date: May 2007
Last Activity: 23 May 2007, 2:41 AM EDT
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
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
    #4  
Old 05-23-2007
simo007 simo007 is offline
Registered User
 
Join Date: May 2007
Last Activity: 23 May 2007, 2:41 AM EDT
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
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
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Piping Unix Variable Array values into AWK k1ko Shell Programming and Scripting 3 11-17-2010 02:53 PM
piping from C to python in UNIX Dreams in Blue Programming 0 05-04-2008 08:02 AM
Java with Unix (Redirection + Piping) fluke_perf Programming 3 04-30-2008 11:52 AM
piping lnatz Shell Programming and Scripting 1 07-14-2006 02:30 AM
Help (Piping ls, tr, cut) scan Shell Programming and Scripting 2 02-11-2006 07:40 AM



All times are GMT -4. The time now is 10:08 PM.