how to add new line character


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting how to add new line character
# 1  
Old 11-21-2007
how to add new line character

Hello All,

I want to add new line character to each of the line '\n'.what is the unix command i can use to do that.File is like below

a|b|c
c|d|f
# 2  
Old 11-21-2007
Try the following.

cat filename | sed 's/$/\\n/g' > newfilename
# 3  
Old 11-21-2007
Many systems have a ux2dos (or unix2dos) command.
# 4  
Old 11-23-2007
MySQL

Hey,

You can use the following three commands to add a new line to a file.

echo "\n" >> file.outor

echo -e "\n" >> file.out

echo >> yourfile

Thanks Smilie
This User Gave Thanks to varungupta For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Add to the second line of the file first character

I have a file: H,20180620093911,VPAS,TRANSHDR,20180620,VPAS.TRANS_HDR.20170731.01.txt, ,876,496737dd53431ef666cad1a3511b3c5a8912f505bf6edfb9d0e225fb049ce934, T,1, I need to add to the second line I have a command sed, how can I find the second line? Thanks for contribution (4 Replies)
Discussion started by: digioleg54
4 Replies

2. Shell Programming and Scripting

How to add a character after the first word/space on each line?

Hi:) I have a large file ( couple thousand lines ) and I'm trying to add a character after the first word/space on each line. eg: First line of text Second line of text Third line of text Fourth line of text Fifth line of text I'd like to accomplish: First - line of text Second... (8 Replies)
Discussion started by: martinsmith
8 Replies

3. Shell Programming and Scripting

Conditionally add character at end of line

Hi, I would like have a shell script to check every line in a file to see if it ends with ";". If this is NOT the last character ";" should be added. MyFile.csv : web9331801;01/01/2014 23:39:35;;"93962";353150256; web9331802;01/01/2014 23:44:29;;"479288";353153538; web9331803;01/01/2014... (14 Replies)
Discussion started by: vg77
14 Replies

4. Shell Programming and Scripting

How to add a character at end of line?

Hai, I have got a small requirement in my script. and i am using bash shell. I need to add a dot (.) for some particular line in a file. Say for example, $Cat rmfile 1 This is line1 2 This is line2 3 This is line3 O/p should be : $Cat rmfile 1 This is line1 2 This is line2. #... (2 Replies)
Discussion started by: Sivajee
2 Replies

5. Shell Programming and Scripting

Remove new line character and add space to convert into fixed width file

I have a file with different record length. The file as to be converted into fixed length by appending spaces at the end of record. The length should be calculated based on the record with maximum length in the file. If the length is less than the max length, the spaces should be appended... (4 Replies)
Discussion started by: Amrutha24
4 Replies

6. Shell Programming and Scripting

Add new line before specific character

hello all, I have file like this "infile.txt" (all data in one line) A240 582247.99974288.7 8.0 239 582248.19974301.1 8.0 238 582248.39974313.6 8.01A 237 582248.49974326.1 8.0 236 582248.69974338.6 8.0 235 582248.79974351.1 8.01A 234 582248.99974363.5 8.0 233 582249.19974376.0 8.0 232... (4 Replies)
Discussion started by: attila
4 Replies

7. Shell Programming and Scripting

add character to every end-of line in file

Hi All I have a file which conatins record.the length of every records is 47. problem : in the end of record i don't have a "\015" character. i want to add this "\015" charcter in the end of every record. the file contains something like 700 records. i've tried with sed command - nothing. ... (8 Replies)
Discussion started by: naamas03
8 Replies

8. Shell Programming and Scripting

add character to the end of each line in file

hi all i have 32 lines in file. the length of each line is 82 , i want that in the end of each line , means in postion 83-84 to put two characters 0d(=\015), 0a(=\012) i want that the 0d will be in postion 83 and the 0a will be in postion 84 in each line of the file how shall i do it ? ... (7 Replies)
Discussion started by: naamas03
7 Replies

9. Shell Programming and Scripting

CSH: Concatenating Strings, how to add new line character and functions?

Hello, I'm trying to run a program on a directory (traverse sub dirs too) through my csh script. Arrays support in CSH is appalling, something like associative arrays would have helped me do this so much easier. Anyway, I want to hold some details extracted from the program and then at the... (0 Replies)
Discussion started by: ragabonds
0 Replies

10. UNIX for Dummies Questions & Answers

How to add new line character at the end of a file

hi all, i have this question: How to add new line character at the end of a file???? i need this because i am loading a file to sybase and i have problems with the last record thanks for your help (5 Replies)
Discussion started by: DebianJ
5 Replies
Login or Register to Ask a Question