Visit Our UNIX and Linux User Community

Listing words from a file on a Separate Line

Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Listing words from a file on a Separate Line
# 1  
Old 03-14-2001

I want to list all the words in my file on a separate line.
I am using the bourne(sh)/bourne again shell(bash).


# 2  
Old 03-14-2001
I'm not sure I understand what you are looking to do. What kind of file is it? Can you give a small example?
# 3  
Old 03-14-2001
If you want each word in the file printed on a separate line, you can translate spaces to newlines with:

tr '[:space:]' '\n' < file


Previous Thread | Next Thread
Test Your Knowledge in Computers #541
Difficulty: Medium
In a statically typed language, a variable cannot be declared before it can be used.
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Replace particular words in file based on if finds another words in that line

Hi All, I need one help to replace particular words in file based on if finds another words in that file . i.e. my self is peter@king. i am staying at north sydney. we all are peter@king. How to replace peter to sham if it finds @king in any line of that file. Please help me... (8 Replies)
Discussion started by: Rajib Podder
8 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

Search words in multiple file line by line

Hi All I have to search servers name say like 1000+ "unique names" line by line in child.txt files in another file that is a master file where all server present say "master.txt",if child.txt's server name matches with master files then it print yes else no with server name. (4 Replies)
Discussion started by: netdbaind
4 Replies

4. Shell Programming and Scripting

How to grep a log file for words listed in separate text file?

Hello, I want to grep a log ("server.log") for words in a separate file ("white-list.txt") and generate a separate log file containing each line that uses a word from the "white-list.txt" file. Putting that in bullet points: Search through "server.log" for lines that contain any word... (15 Replies)
Discussion started by: nbsparks
15 Replies

5. Shell Programming and Scripting

Compare two string in two separate file and delete some line of file

Hi all i want to write program with shell script that able compare two file content and if one of lines of file have # at the first of string or nothing find same string in one of two file . remove the line in second file that have not the string in first file. for example: file... (2 Replies)
Discussion started by: saleh67
2 Replies

6. Shell Programming and Scripting

read one line file and separate into multiple lines

I have one long line text with semicolon used as separator between values in that line. Now, I want to separate the line into multiple line right after every 29th field. example input line: ... (1 Reply)
Discussion started by: erlanq
1 Replies

7. Shell Programming and Scripting

How to separate file to multiple line.

Hi Unix gurus, I am facing a problme with file. I need separate my file into multiple line. eg. Soure file: PRT07, aaa, bbb, 46, PRT06, ccc, ddd, 57, PRT05, eee,fff,aa, target file: PRT07, aaa, bbb, 46 PRT06, ccc, ddd, 57 PRT05, eee,fff,aa :wall: thanks in advance (4 Replies)
Discussion started by: ken002
4 Replies

8. Shell Programming and Scripting

separate file by line length

hi all, i'm new in unix.... i have question, sorry if it's missplace or too silly let say i have a file name testfile.log that contains data 000001 000002 000003 aaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbb cccccccccccccc dddddddddddddddddd 000004 i want to make new file... (3 Replies)
Discussion started by: venven
3 Replies

9. UNIX for Dummies Questions & Answers

how to separate numbers and words from a file using shell scripts

Hi, How to separate numbers and words(with full alphabets) in a particular file and store it in two different files. Please help me out for this.Using shell scripting. :confused::confused: (1 Reply)
Discussion started by: kamakshi s
1 Replies

10. Shell Programming and Scripting

To read and separate number and words in file and store to two new file using shell

hi, I am a begginer in unix and i want to know how to open a file and read it and separate the numbers & words and storing it in separate files, Using shell scripting. Please help me out for this. Regards S.Kamakshi (2 Replies)
Discussion started by: kamakshi s
2 Replies

Featured Tech Videos