Alex Rivera | Logout

bash cat multiple files content in to single string without newlines

Asked 2010-10-14T19:20:12.217
15

i got some files with name start as eg_. and only each contains one single line

eg_01.txt: @china:129.00

eg_02.txt @uk:219.98

eg_03.txt @USA:341.90

......

i am expecting to cat them in to a single line to send by URL like: @china:129.00@uk:219.98@USA:341.90

i use echo cat eg_*

it give me the output look like a string, but it actually contains new line: "@china:129.00

@uk:219.98 @USA:341.90"

is there any other way i can construct that string which expected and get rid of new line and even the space? is only cat enough to do this?

thanks in advance

Edit
Report

1 Answer

3

Using only one command

url=$(awk '{printf "%s",$0}' eg*)
answered 2010-10-14T23:56:51.850

Your Answer