Removing blank space in file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Removing blank space in file
# 1  
Old 07-03-2012
Removing blank space in file

TT0000013101257

|
JCJMMUJMMUB018

| Jul 3 2012 10:56AM |
JAMMU & KASHMIR

|
Hari Market

|
AIRCEL

| 9018611387 | 9018721313 | 9858399311 | NULL
TT0000013101355

|
WCSNDASNDAB001

| Jul 3 2012 11:00AM |
WEST BENGAL

|
Sanada

|
AIRCEL

| 9331110289 | 9331896477 | 9804199329

I have data in pipe separated form.

I want to remove all blank space and show it in one line.

I tried "cat temp | sed -e 's/ *| */|/g'" but its giving me O/P like


TT0000013101257|
JCJMMUJMMUB018|Jul 3 2012 10:56AM|
JAMMU & KASHMIR|
Hari Market|
AIRCEL|9018611387|9018721313|9858399311|NULL
TT0000013101355|
WCSNDASNDAB001|Jul 3 2012 11:00AM|
WEST BENGAL|
Sanada|
AIRCEL|9331110289|9331896477|9804199329|NULL

plz suggest script


| NULL


Moderator's Comments:
Mod Comment Duplicate Thread - Closed

Last edited by zaxxon; 07-03-2012 at 03:34 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help to identify blank space in a file

Hello, I have a dictionary of over 400,000 words with the following structure source=target The database contains single words as well as phrases. To train the data, I need only mappings with out a space i.e. where both source and target do not have any space in between. I use Ultraedit as... (4 Replies)
Discussion started by: gimley
4 Replies

2. Shell Programming and Scripting

How to check if the file is empty or has blank space.?

Hi, I am using KSH. I am trying to check if the output file is empty or not. I tried with ] but what i see is my file is empty but still manages to have a size of 1 instead of 0. But my file doesnot have anything its empty. I am not sure how to check this. can any one help? (10 Replies)
Discussion started by: Sharma331
10 Replies

3. Shell Programming and Scripting

Removing blank space using VI

Hi, How to remove blank spaces using vi (I am using AIX)? #cat siva.txt AAA BBB CCC DDD EEE FFF Need to remove space between 2 columns. Regards, Siva (7 Replies)
Discussion started by: ksgnathan
7 Replies

4. Shell Programming and Scripting

Remove Space and blank line from file in UNIX shell script

I have below file. I want to remove space at begining of every line and then after also remove blank line from file. I use below code for each operation. sed -e 's/^*//' < check.txt > check1.txt sed '/^\s*$/d' < check1.txt > check2.txt above code not remove all the space... (12 Replies)
Discussion started by: Mohin Jain
12 Replies

5. Shell Programming and Scripting

Removing blank lines from a file

Hi All, How do i remove continuos blank lines from a file. I have a file with data: abc; def; ghi; jkl; mno; pqr; In the above file, there are two blank lines. I want to remove, one out of them. My output should look like: (2 Replies)
Discussion started by: raosr020
2 Replies

6. UNIX for Dummies Questions & Answers

Removing blank lines in a file

Hi I have a text file that has blank lines at different places. How to remove all the blank lines in a file? Thanks Ashok (3 Replies)
Discussion started by: ashok.k
3 Replies

7. Shell Programming and Scripting

Removing blank lines from comma seperated and space seperated file.

Hi, I want to remove empty/blank lines from comma seperated and space seperated files Thanks all for help (11 Replies)
Discussion started by: pinnacle
11 Replies

8. Shell Programming and Scripting

Blank Space is not appending in each row of CSV File - Shell Script

I am calling SQL script in my UNIX Shell script and trying to create the CSV file and my last column value of each row is 23 blank spaces. In my SQL script,the last column is like below. RPAD(' ',23,' ') -- Padding 23 blank Spaces The CSV file is generated but the sapce(23 spaces) is... (2 Replies)
Discussion started by: praka
2 Replies

9. Shell Programming and Scripting

Removing blank columns from a file

Hi, I have a sample file as shown below -- id parent name dba -----------------------------------... (7 Replies)
Discussion started by: sumirmehta
7 Replies

10. Shell Programming and Scripting

Removing blank spaces from a file?

Guys, I need some help... how can I remove the blank spaces between the lines below? (between the date and the hour fields) 21/05/07 00:05:00 99 21/05/07 00:10:01 99 21/05/07 00:15:00 99 21/05/07 00:20:00 99 21/05/07 00:25:00 99 I want to make the file... (4 Replies)
Discussion started by: dfs
4 Replies
Login or Register to Ask a Question