Sed Add New Lines


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Sed Add New Lines
# 1  
Old 10-13-2005
Sed Add New Lines

Hello,

I have a file that has data like this:


Code:
one two three four
five
six seven
eight nine ten

Is there a quick way using sed of nawk to put each word on it's own line?
Thanks.
# 2  
Old 10-13-2005
Code:
tr ' ' '\n' < file.contaning.data

If awk, then define your OFS as \n and FS as ' '

Similiar is the case with sed.
# 3  
Old 10-13-2005
Beautiful!!! Thank you.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Add string into certain lines - sed

Hello all, I have surely an easy question - but at the moment I do not see the solution. All what I want is to add the string "/9201" within a file when a line starts with ":47A:". This is how a file look like: Information Tool :12:Delimiter :3:Space :47A:0329 :3:Space After the... (2 Replies)
Discussion started by: API
2 Replies

2. Shell Programming and Scripting

ksh sed - Extract specific lines with mulitple occurance of interesting lines

Data file example I look for primary and * to isolate the interesting slot number. slot=`sed '/^primary$/,/\*/!d' filename | tail -1 | sed s'/*//' | awk '{print $1" "$2}'` Now I want to get the Touch line for only the associate slot number, in this case, because the asterisk... (2 Replies)
Discussion started by: popeye
2 Replies

3. Shell Programming and Scripting

Use sed to print first n lines and last n lines of an output.

Use sed to print first n lines and last n lines of an output. For example: n=10 Can it be done? Thanks. (7 Replies)
Discussion started by: carloszhang
7 Replies

4. Shell Programming and Scripting

sed print all lines between second and third identical lines

I am trying to extract a table of data (mysql query output) from a log file. I need to print everything below the header and not past the end of the table. I have spent many hours searching with little progress. I am matching the regexp +-\{99\} with no problem. I just can't figure out how to print... (5 Replies)
Discussion started by: godfreydanials
5 Replies

5. Shell Programming and Scripting

Summing over specific lines and replacing the lines with the sum using sed, awk

Hi friends, This is sed & awk type question. I have a text file which has numbers spread all over the file. I want to sum the series of numbers whenever i find it and produce an output file with the sum. For example ###start of input text file #### abc def ghi 1 2 3 4 kjld random... (3 Replies)
Discussion started by: kaaliakahn
3 Replies

6. UNIX for Dummies Questions & Answers

Using sed to change lines and add them if they don't exist..

I've googled the hell out of this, and in my quest to advance my knowledge and expertise in modifying phones to make them more awesome, I ended up here. I've found answers about patterns and whatnot that seem really complex for what I am trying to do, and basically it is this: if the line says... (2 Replies)
Discussion started by: Silentbtdeadly
2 Replies

7. Shell Programming and Scripting

Sed/awk to delete single lines that aren't touching other lines

Hello, I'm trying to figure out how to use sed or awk to delete single lines in a file. By single, I mean lines that are not touching any other lines (just one line with white space above and below). Example: one two three four five six seven eight I want it to look like: (6 Replies)
Discussion started by: slimjbe
6 Replies

8. Shell Programming and Scripting

sed show lines text between 2 blank lines

I have a file like blah blah blah blah this is the text I need, which might be between 1-4 lines, but always has a blank line above and below it, and is at the end of the text file the code tags don't show the trailing blank line. I started by deleting the last blank line with: ... (2 Replies)
Discussion started by: unclecameron
2 Replies

9. Shell Programming and Scripting

Add lines with sed or awk

I want to get an output from the input as below: Input: ASDDS14 RXOTX-39-8 AB0991C TRY1900 AEDFS12 RXOTX-39-9 TK0991C TRY800 HSVDS11 RXOTX-389-10 LG0991C TRY1900 BSDDS09 RXOTX-394-0 AA0066A TRY800 OUTPUT: ASDDS14 RXOTS-39-8-0 AB0991C TRY1900... (2 Replies)
Discussion started by: aydj
2 Replies

10. Shell Programming and Scripting

sed problem - delete all lines until a match on 2 lines

First of all, I know this can be more eassily done with perl or other scripting languages but, that's not the issue. I need this in sed. (or wander if it's possible ) I got a file (trace file to recreate the control file from oracle for the dba boys) which contains some lines another line... (11 Replies)
Discussion started by: plelie2
11 Replies
Login or Register to Ask a Question