onlyf
onlyf

Reputation: 873

Sed - Adding white spaces to the end of line

after some research here i ran across this use of SED :

sed 's/$/       /' filein > fileout

This worked as expected in some files, and added the spaces to the end of the line.

My problem is that in a different file like this :

AAAAAAAAAAAAAAAAAAAAAAAAA BBBBBBBBBBBBBBBBBBBBBBBBB
BBBBBBBBBBBBBBBBBBBBBBBBB CCCCCCCCCCCCCCCCCCCCCCCCC

and after running that same command to append some spaces (7) at the end of each line, it basicly adds a different line and puts the 7 spaces there, like :

AAAAAAAAAAAAAAAAAAAAAAAAA BBBBBBBBBBBBBBBBBBBBBBBBB(CR)
spacesx7(cr)(lf)
BBBBBBBBBBBBBBBBBBBBBBBBB CCCCCCCCCCCCCCCCCCCCCCCCC(CR)
spacesx7(cr)(lf)

Could someone help me? Thank you in advance

Upvotes: 0

Views: 131

Answers (1)

Cyrus
Cyrus

Reputation: 88543

Try this:

dos2unix < filein | sed 's/$/       /' > fileout

Upvotes: 2

Related Questions