removing a space


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting removing a space
# 1  
Old 08-18-2009
removing a space

Hi I want to remove a space for column 6. basically column 6 in my file looks like this:

Code:
tig 2
tig 9
tig 39
tig 300

I want the output to look like this:

Code:
tig2
tig9
tig39
tig300

How do I remove that space just for column 6.

thanks

Last edited by vgersh99; 08-18-2009 at 06:55 PM.. Reason: code tags, PLEASE!
# 2  
Old 08-18-2009
Post a data sample and what you try until now using [code] tags and we will try to help you.
# 3  
Old 08-18-2009
To keep the forums high quality for all users, please take the time to format your posts correctly.

First of all, use Code Tags when you post any code or data samples so others can easily read your code. You can easily do this by highlighting your code and then clicking on the # in the editing menu. (You can also type code tags [code] and [/code] by hand.)

Second, avoid adding color or different fonts and font size to your posts. Selective use of color to highlight a single word or phrase can be useful at times, but using color, in general, makes the forums harder to read, especially bright colors like red.

Third, be careful when you cut-and-paste, edit any odd characters and make sure all links are working property.

Thank You.

The UNIX and Linux Forums
# 4  
Old 08-18-2009
sorry

im sorry...

thanks
# 5  
Old 08-18-2009
Quote:
Originally Posted by kylle345
im sorry...

thanks
not sure what you're sorry about, but that's ok.........
# 6  
Old 08-18-2009
kylle345 is probably sorry because of this

@phil_heath:

This is something a little sed script can do for you. It seems to me that the column you are trying to change is 5, not 6, but maybe i am missing a leading space. Anyways, you can modify the script yourself easily, the five full stops i put in represent 5 random characters followed by a space. If you have to change the column simply add/delete some of the full stops to adjust:

Code:
sed 's/^\(.....\) /\1/' /path/to/sourcefile > /path/to/resultfile

I hope this helps.

bakunin
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Removing pipe and space in a file

Hi , I have a file which is like below. The file record is separated by | as delimiter. I want to remove the first and last | in the file and also I want to remove the spaces in the columns. Original File |3464114 |10 | REPORT|CA| 1|0|4825400|0|213167| 939396524| Expected:... (3 Replies)
Discussion started by: arunkumar_mca
3 Replies

2. Shell Programming and Scripting

Fixed with file- removing leading zeros and adding the space

Hi All, i have a fixed width file , where each line is 3200 length. File: 1ABC 1111 2222 3333 000012341 1001 2ABC 1111 2222 3333 000012342 1002 3ABC 1111 2222 3333 000112343 1003 1DEF 5555 4444 9696 000012344 1004 2DEF 5555 2323 8686 000012345 1005 3DEF 5555 1212 7676 000012346 1006 ... (1 Reply)
Discussion started by: mechvijays
1 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

Removing white space in awk

Hi How to remove white space from this input:|blue | 1| |green| 4| |black| 2| I like to search for green and get 4not 4 How to modify this to work correct:awk -F"|" '/green/ {print $3} (7 Replies)
Discussion started by: Jotne
7 Replies

5. Shell Programming and Scripting

Removing blank space in file

TT0000013101257 | JCJMMUJMMUB018 ... (0 Replies)
Discussion started by: sususa
0 Replies

6. 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

7. Shell Programming and Scripting

removing space

US76132M1027|NASDAQ Capital Market|NASDAQ Capital Hi I want to remove the leading space ,i have a file full of lines with this space pls help me (6 Replies)
Discussion started by: surenz298
6 Replies

8. AIX

Removing page space

I having problem removing a page space.... 1. When I list the page spaces available in the system, I am getting the following messages 0516-310 : Unable to find attribute state in the Device Configuration Database. Execute synclvodm to attempt to correct the database.... (4 Replies)
Discussion started by: srnkumar
4 Replies

9. Shell Programming and Scripting

Removing Space at the end of file

Hi.... I have a situation...I have a data file...that has space(an extra row with no data) at the end of file. I am trying to remove that spaces only if the file has a space at the end of file and if there is no space I don't want to do anything. Can you please help me in this regards. ... (4 Replies)
Discussion started by: rkumar28
4 Replies

10. Shell Programming and Scripting

re: removing trailing space from lines

Not sure why this thread was closed without any explanation, but you can do what you're asking with sed 's/]*$//g' < sourceFile > destFile (1 Reply)
Discussion started by: oombera
1 Replies
Login or Register to Ask a Question