add carriage return at end of file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting add carriage return at end of file
# 1  
Old 11-19-2007
add carriage return at end of file

Hi I would like to add carriage return at end of file,
because we need to mask the customer names for detailed records.

Some what the file doesnot have carriage at end of line of last record.So that i 'll get 2 records when use

---aa.txt-----
1|aaa|bbb|ccc
2|bbbb|hghgh|ggg
000002

tail -1 aa.txt

2|bbbb|hghgh|ggg
000002

how can i add carriage return at end of line?

Thanks for your advise in advance

Regards,
Haa
# 2  
Old 11-19-2007
Do you mean "line-feed", not "carriage-return"?

this will append a newline...

Code:
echo >>file

# 3  
Old 11-20-2007
add carriage return at end of file

Quote:
Originally Posted by porter
Do you mean "line-feed", not "carriage-return"?

this will append a newline...

Code:
echo >>file

Thanks a lot,i'll cosed it.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

awk Command to add Carriage Return and Line Feed

Hello, Can someone please share a Simple AWK command to append Carriage Return & Line Feed to the end of the file, If the Carriage Return & Line Feed does not exist ! Thanks (16 Replies)
Discussion started by: rosebud123
16 Replies

2. Shell Programming and Scripting

Add a carriage return after every sorted field

Hi All, I have a text file - nmn-smt-1039.test.com:SearchService-WW:x:8277 nmn-smt-1102.test.com:AdminConsole-ww:x:8536 nmn-smt-1041.test.com:SearchService-WW:x:8277 nmn-wsf-1007.test.com:Service-ww:x:8532 nmn-smt-1042.test.com:SearchService-WW:x:8277... (3 Replies)
Discussion started by: jacki
3 Replies

3. Shell Programming and Scripting

Need Help to delete carriage return and new line in csv file

Hi All, I have a problem loading the data from a csv file As you see below in the Input ,For the Data starting with " there are 2 lines, which i want to make them into single without changing the format of that data. You can see the desired output below: While i try to open the csv file and... (4 Replies)
Discussion started by: mlavanya
4 Replies

4. Shell Programming and Scripting

Removing Carriage return in a file after particular string

Hi All, I want to remove carriage return in a file using some unix command without writing a script my file is as follows abc1 abc2 abc3 abc4 abc5 bac6 abc1 abc2 abc3 abc4 abc5 bac6 I want the output as follows: abc1 abc2 abc3 abc4 abc5 bac6 abc1 abc2 abc3 abc4 abc5 bac6 , Please... (7 Replies)
Discussion started by: manish8484
7 Replies

5. Shell Programming and Scripting

Need a carriage return at end of each line

Hi All, I am reading two files and writing out the file name and count of lines in each file to an output file. My script looks like this: echo "input_file1.out;`wc -l < input_file1.out | sed 's/^]*\(.*\)]*$/\1/'` " > comp_file1.out echo "input_file2.out;`wc -l < input_file2.out | sed... (2 Replies)
Discussion started by: Hangman2
2 Replies

6. UNIX for Advanced & Expert Users

Padding Carriage return to the end of XML file

Hi All, I am getting a xml file where the first field contains a carriage return and the all other fields doesnot contains any carriage return. So all the other records comes in the second line. <?xml version="1.0" encoding="UTF-8"?> <ns0:iSeriesCspIntegration... (3 Replies)
Discussion started by: dasj22
3 Replies

7. Shell Programming and Scripting

Carriage Return at end of file

Hi, I have a script that outputs a file that contains the dates from the previous month, which is then used by our application to run processes on each date contained in the file. My problem is is that my script created a blank line at the bottom of the file which causes issues for our... (14 Replies)
Discussion started by: bd_joy
14 Replies

8. UNIX for Dummies Questions & Answers

Remove a carriage return at end of variable

Is there a command in unix to remove a carriage return character(^M) at the end of a variable value? (5 Replies)
Discussion started by: flagship99
5 Replies

9. UNIX for Dummies Questions & Answers

Removing carriage return characters from file

Hello there, I need to remove carriage return characters (\n and \r) from any input file specified. This is what I am doing right now: - dumping the file to octal format using the command 'od -c file_name - removing and \s and \n characters using sed commands What I need to do now is... (3 Replies)
Discussion started by: b1saini
3 Replies

10. Shell Programming and Scripting

Regex to pick up name from the following including carriage return at end of the line

has anyone got any suggestions how i would pick up the string as part of a substitution inclusive of the carriage return. ie i want to pick up <<NAME>> from the PS output but the <<; seems to be on the line before the NAME. Any ideas are appreciated! ... (3 Replies)
Discussion started by: Shakey21
3 Replies
Login or Register to Ask a Question