Removing specific field seperator to combine two fields
Hello all, here is my first post!
I am trying to remove the space between the 2nd and 3rd fields but just cannot work out how to do it. I've considered sed, cut, awk... I know with sed you can replace all instances within a file but can you also specify to remove, say, the 2nd instance of a space in each line (this would be perfect for me)? DAAE 60 402 Bejaia Algeria 1 36-43N 005-04E 36-43N 005-04E 2 2 P DAAG 60 390 Dar-El-Beida Algeria 1 36-43N 003-15E 36-43N 003-15E 25 25 P DAAJ 60 670 Djanet Algeria 1 24-33N 009-28E 24-33N 009-28E 1054 1054 P DAAP 60 640 Illizi Algeria 1 26-30N 008-25E 26-30N 008-25E 558 558 P DAAS 60 445 Setif Algeria 1 36-11N 005-25E 36-11N 005-25E 1038 1081 P DAAV 60 351 Jijel Achouat Algeria 1 36-53N 005-49E 2 10 P DAAY 60 549 Mecheria Algeria 1 34-56N 000-26W 34-56N 000-26W 1149 1149 P Thanks everyone. |
Quote:
Try "sed 's/ //2'". |
This will do it too:
Code:
awk '{ print $1, $2$3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13 }' |
I said I knew how to take out ALL instances using sed but couldn't work out how to specify just a particular part of a line.
[Try "sed 's/ //2'"] - yep it worked! I didn't know that placing the 2 there specified which one to take out. Thanks. |
All times are GMT -5. The time now is 10:35 PM. |