petguego
16th May 2006, 16:42
Hello to all, I need an aid, I have a text file created in UNIX by a session baan IV, the file is normal, with row and columns. what I need is he himself file, but I need everything in a line, bony without line jumps, Can be done this?

Thank you very much
petguego :rolleyes:

dave_23
16th May 2006, 19:28
Hi petguego,

Very difficult to understand what you're looking for - but let's take a stab at it.

You have a Unix file:

A 1 2 3 4 5 6 7
B 1 2 3 6 9 1 4
C 2 4 5 6 7 8 9

and you want to just 1 line (say in this case B)? you can do

egrep "^B" filename > newfile

Am i on the right track?

Dave

petguego
16th May 2006, 22:37
I send an example to you of which I want:

File A

A1234567890
B1234567890
C1234567890
D1234567890

Result in File B A1234567890B1234567890C1234567890D1234567890

The idea is to suppress the jumps of line of each registry and to leave it in a line all the file

Thank you very much
Petguego

dave_23
17th May 2006, 02:50
That's a toughy.

The closest i can get is

for a in `cat filename`; do
echo -n $a >> newfile
done

doing that, you don't have a newline at the end of your one-long line though.

Also "echo -n" isn't always standard - make sure you "man echo" first.

Dave

Brendan Shine
17th May 2006, 19:32
Use can also use tr as well do delete the newline characters as follows and then append a newline at the end using echo.

Input file:
$cat /tmp/filename
abc
123
xyz

Command to Process the File and Output from the Command:
$cat /tmp/filename | tr -d '\n';echo
abc123xyz
$