LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 06-15-2005, 04:47 AM   #1
learnfast
Member
 
Registered: Mar 2005
Location: berlin
Distribution: Redhat 9, Fedora 3
Posts: 70

Rep: Reputation: 15
how to pipe and parse output of a command


if the output of a command is e.g. "HEIGHT=1 WIDTH=14 COLOR=red SIZE=23" how can "pipe and parse" so that I get this output in a file:
HEIGHT=1
WIDTH=14
COLOR=red
SIZE=23

something like:
thecommand | replace(" ","\n") > output.txt

thanks
 
Old 06-15-2005, 04:53 AM   #2
hardcorelinux
Member
 
Registered: Jan 2005
Location: India
Distribution: RHEL,CentOS,SUSE,Solaris10
Posts: 183

Rep: Reputation: 31
simply

command > output_file

hereoutput will stored in output_file

command > output_file 2> error_file
Here, stdout goes to output_file while anything written to stderr goes to error_file.
 
Old 06-15-2005, 04:55 AM   #3
trevelluk
Member
 
Registered: Nov 2003
Location: Bristol, UK
Distribution: Debian Lenny, Gentoo (at work)
Posts: 388

Rep: Reputation: 32
That doesn't add the newlines though, which from the look of it is the key thing. Try:

command | tr " " "\n" > output.txt
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to pipe output from make BBB Programming 2 05-20-2005 06:14 AM
pipe xine output to file sohmc Linux - Software 0 01-01-2005 10:03 PM
parse output ky-lab_rat Linux - Newbie 7 01-23-2004 01:47 PM
Read the output from a pipe with bash ? fluppi Linux - Software 3 01-13-2004 12:59 PM
Output truncated when using pipe tells Linux - General 1 12-16-2003 08:06 PM


All times are GMT -5. The time now is 10:34 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration