LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 08-06-2003, 03:22 PM   #1
legtester
LQ Newbie
 
Registered: Jul 2003
Posts: 4

Rep: Reputation: 0
Question Inserting a carriage return in awk


Hi,

I'm trying to use awk to pull data from a file and output the results through a command line utility. Specifically, I have a file that has a long number on each line. I want to take each number out of this file, and run the number through a command line utility one by one...and eventually output the results to another file (but I'm not to this point yet).

I am able to match each line from my file and output each line to the screen. However, I need to insert a carriage return after each line of output in order for my command line utility to run before moving on to the next line. This is what I have:

awk '// { printf "tslp -username test -password testing -serialnumber %s\r\n", $0; next }' < v2.out

Can anyone help me with this? Sorry if my description is confusing!

Thanks!
 
Old 08-17-2003, 05:29 PM   #2
MacKtheHacK
Member
 
Registered: Jul 2003
Location: Boston, MA, USA
Distribution: RedHat, SuSE, Gentoo, Slackware, Mandrake ...
Posts: 111

Rep: Reputation: 15
I think I get what you're doing, but I don't see what the problem is. I ran that command and I get a carriage-return/line-feed pair at the end of each line of output.

Why do you need the carriage-returns on there? Are you going to run the commands this outputs as a batch file on Windows or something? If not, you probably really want to be using xargs(1), which does this in a more direct way. Try this:

xargs -l1 tslp -username test -password testing -serialnumber <v2.out

That will run your tslp command once for each line in v2.out, putting the line on the end of the tslp command line. Isn't that what you want?
 
  


Reply



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
grep detecting carriage return, how ? Grafbak Programming 22 01-13-2010 01:19 PM
Find & Replace Carriage Return in ooo linuxian Linux - Software 1 04-09-2005 05:43 PM
carriage return in emac lisp balloon Programming 1 11-23-2004 08:29 AM
unescaping a carriage return in perl acid_kewpie Programming 10 09-20-2002 02:20 PM
pppd...carriage return?!? icyfire Linux - Software 1 02-14-2002 07:07 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 12:33 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration