remove newline chars in each record of file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting remove newline chars in each record of file
# 1  
Old 06-12-2009
remove newline chars in each record of file

Hi,

I have a fixed width file with record length 10.
I need to remove multiple newline characters present in each record.

EX:
af\n72/7\n
s\n3\nad\n
2\n\n33r\n
In the above file I want to remove new lines in red color(\n) but not (\n)

Please provide me a solution.

Thanks,
Sri
# 2  
Old 06-12-2009
may be something like this works for you...
Code:
sed -e 's/\\n//g' inputfile | awk '{print $0"\\n"}'

Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Remove newline character from column spread over multiple lines in a file

Hi, I came across one issue recently where output from one of the columns of the table from where i am creating input file has newline characters hence, record in the file is spread over multiple lines. Fields in the file are separated by pipe (|) delimiter. As header will never have newline... (4 Replies)
Discussion started by: Prathmesh
4 Replies

2. Shell Programming and Scripting

sed to remove newline chars based on pattern mis-match

Greetings Experts, I am in AIX; I have a file generated through awk after processing the input files. Now I need to replace or remove the new-line characters on all lines that doesn't have a ; which is the last character on the line. I tried to use sed 's/\n/ /g' After checking through the... (6 Replies)
Discussion started by: chill3chee
6 Replies

3. Shell Programming and Scripting

Read value of a file, remove first 2 chars and put this value in a variable

Hi i have need of read a file value with cat command and remove first 2character for example cat /sys/class/rtc/day 0x12 Remove char 12 And put this value in a variable is possible with a script thanks for help (6 Replies)
Discussion started by: enaud
6 Replies

4. Shell Programming and Scripting

Remove newline character or join the broken record

Hi, I have a very huge file, around 1GB of data. I want to remove the newline characters in the file but not preceded by the original end delimiter {} sample data will look like this 1234567 abcd{} 1234sssss as67 abcd{} 12dsad3dad 4sdad567 abcdsadd{} this should look like this... (6 Replies)
Discussion started by: ratheeshjulk
6 Replies

5. Shell Programming and Scripting

Shell to remove a newline char from selected rows in a file.

Greetings! Can we automate the process of removing a newline char from selected rows in a fixed width file using a shell? Input is like abcd1234 xyzd1234 abcd a1b2c3d4 abcd1234 xyzd1234 xx abcd1234 Expected output - abcd1234xyzd1234 abcda1b2c3d4abcd1234xyzd1234 xxabcd1234 ... (3 Replies)
Discussion started by: mailme0205
3 Replies

6. Shell Programming and Scripting

To remove a particular record from File

Dear Friends, Need your help to fix the issue we are facing. We have a requirement - Need to remove specific records from a comma separated file and create new file. It should check "filter.csv" file and then accordingly remove records from the input file and generate the output file.(not case... (5 Replies)
Discussion started by: SatishW
5 Replies

7. Shell Programming and Scripting

Remove particular record from a file

Hi:), I am having 110 records in a file and I want to delete particular record (say 63rd) . Which command can be use to achieve this ? (4 Replies)
Discussion started by: devmns
4 Replies

8. Shell Programming and Scripting

To remove the newline character while appending into a file

Hi All, We append the output of a file's size in a file. But a newline character is appended after the variable. Pls help how to clear this. filesize=`ls -l test.txt | awk `{print $5}'` echo File size of test.txt is $filesize bytes >> logfile.txt The output we got is, File size of... (4 Replies)
Discussion started by: amio
4 Replies

9. Shell Programming and Scripting

How to remove a particular record from a file?

Please tell me the command(s) to remove a particular record from the file and placing the rest of the record in a seperate file. (9 Replies)
Discussion started by: kanu_pathak
9 Replies
Login or Register to Ask a Question