Need output in different lines not in one single line


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Need output in different lines not in one single line
# 1  
Old 02-08-2006
Need output in different lines not in one single line

I am getting the coutput like this as show below in one single line, where as the command is executed is several lines and the output should also be requied in several lines, not in one single line.

Anyone any idea?

Code:
p4 opened -a | grep *locked* | awk '{ printf $8 }' >/tmp/aa


Code:
$ cat /tmp/aa
byapeleg@AlonPeleg-1(text)csaha@test_depo_csahacsaha@test_depo_csahacsaha@test_depo_csahamanomugdha@home_guest_bkup_manomugdha_IxManomanomugdha@home_guest_bkup_manomugdha_IxManomanomugdha@home_guest_bkup_manomugdha_IxManomanomugdha@home_guest_bkup_manomugdha_IxManomanomugdha@home_guest_bkup_manomugdha_IxManomanomugdha@home_guest_bkup_manomugdha_IxManomanomugdha@home_guest_bkup_manomugdha_IxManomanomugdha@home_guest_bkup_manomugdha_IxManomanomugdha@home_guest_bkup_manomugdha_IxManomanomugdha@home_guest_bkup_manomugdha_IxManomanomugdha@home_guest_bkup_manomugdha_IxManomanomugdha@home_guest_bkup_manomugdha_IxManomanomugdha@home_guest_bkup_manomugdha_IxManorjongbloed@rjongbloed-ixmobile-vt-mainrjongbloed@rjongbloed-ixmobile-vt-mainqtrinh

Code:
Required output is like this 

$ cat /tmp/aa
byapeleg@AlonPeleg-1(text)csaha@test_depo_csaha
csaha@test_depo_csaha
csaha@test_depo_csaha
manomugdha@home_guest_bkup_mano
mugdha_IxManomanomugdha@home_guest_bkup_mano
mugdha_IxManomanomugdha@home_guest_bkup_mano
mugdha_IxManomanomugdha@home_guest_bkup_mano
mugdha_IxManomanomugdha@home_guest_bkup_mano
mugdha_IxManomanomugdha
.
.
.
and so on ...

# 2  
Old 02-08-2006
In awk :

printf don't includes new line character, you need to specifically include "\n" in the command...

otherwise you can use print instead of printf which by default adds new line character in the end.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Get an output of lines in pattern 1st line then 10th line then 11th line then 20th line and so on.

Input file: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 (6 Replies)
Discussion started by: Sagar Singh
6 Replies

2. UNIX for Beginners Questions & Answers

Output to file print as single line, not separate line

example of problem: when I echo "$e" >> /home/cogiz/file.txt result prints to file as:AA BB CC I need it to save to file as this:AA BB CC I know it's probably something really simple but any help would be greatly appreciated. Thank You. Cogiz (7 Replies)
Discussion started by: cogiz
7 Replies

3. Shell Programming and Scripting

convert single line output to multiple line

Hi all, I have a single line output like below echo $ips 10.26.208.28 10.26.208.26 10.26.208.27 want to convert above single line output as below format. Pls advice how to do ? 10.26.208.28 10.26.208.26 10.26.208.27 Regards Kannan (6 Replies)
Discussion started by: kamauv234
6 Replies

4. Shell Programming and Scripting

Joining multi-line output to a single line in a group

Hi, My Oracle query is returing below o/p ---------------------------------------------------------- Ins trnas value a lkp1 x a lkp1 y b lkp1 a b lkp2 x b lkp2 y ... (7 Replies)
Discussion started by: gvk25
7 Replies

5. Shell Programming and Scripting

Merge multi-line output into a single line

Hello I did do a search and the past threads doesn't really solve my issue. (using various awk commands) I need to combine the output from java -version into 1 line, but I am having difficulties. When you exec java -version, you get: java version "1.5.0_06" Java(TM) 2 Runtime... (5 Replies)
Discussion started by: flagman5
5 Replies

6. Shell Programming and Scripting

Multiple lines in a single column to be merged as a single line for a record

Hi, I have a requirement with, No~Dt~Notes 1~2011/08/1~"aaa bbb ccc ddd eee fff ggg hhh" Single column alone got splitted into multiple lines. I require the output as No~Dt~Notes 1~2011/08/1~"aaa<>bbb<>ccc<>ddd<>eee<>fff<>ggg<>hhh" mean to say those new lines to be... (1 Reply)
Discussion started by: Bhuvaneswari
1 Replies

7. Shell Programming and Scripting

Two Input Lines Into Single Output Line (CSV)

Hi all, My search karate must be weak because I'm about certain something very like this has been asked and answered here many times. I'll give you the exact scenario I've wasted a few hours of my Saturday on: :wall: I'm trying to read through a very large number (~200) of router and... (28 Replies)
Discussion started by: svermill
28 Replies

8. Shell Programming and Scripting

split single line into two line or three lines

Dear All, I want to split single line into two line or three lines wherever “|” separated values comes using Input line test,DEMTEMPUT20100404010012,,,,,,,,|0070086|0070087, output shoule be test,DEMTEMPUT20100404010012,,,,,,,,0070086, test,DEMTEMPUT20100404010012,,,,,,,,0070087, (14 Replies)
Discussion started by: arvindng
14 Replies

9. Shell Programming and Scripting

Break lines up into single lines after each space in every line

It sounds a bit confusing but what I have is a text file like the example below (without the Line1, Line2, Line3 etc. of course) and I want to move every group of characters into a new line after each space. Example of text file; line1 .digg-widget-theme2 ul { background: rgb(0, 0, 0) none... (7 Replies)
Discussion started by: lewk
7 Replies

10. Shell Programming and Scripting

single line input to multiple line output with sed

hey gents, I'm working on something that will use snmpwalk to query the devices on my network and retreive the device name, device IP, device model and device serial. I'm using Nmap for the enumeration and sed to clean up the results for use by snmpwalk. Once i get all the data organized I'm... (8 Replies)
Discussion started by: mitch
8 Replies
Login or Register to Ask a Question