I want Trailer to be added into the text file.

Hi folks,

I want Trailer to be added into the txt file the format is below.

flatfile-> abc.txt

count of the file is 500 records.

I want the trailer in this format: TRAILER|500 (pipe delimeter).

Please suggest the comands ASAP.

Rgds
Ann

printf "%s\n" "TRAILER|500" >> abc.txt

wc -l (where i will incorporate to make sure it will return the record lenght)

Folks i have this comand

get_records=`wc -l abc.txt'
echo "Trailer|"$reds

after running the above comands I get the o/p as

Trailer| 200 abc

suggest How do I remove the file name abc from the o/p and also a space after TRL|' '

I was expect the o/p as Trailer|200

rgds
Ann

Please put code inside

 tags.



get_records=`wc -l abc.txt'
echo "Trailer|"$reds

[/quote]

[indent]
Do you mean:

echo "Trailer|$get_records"
get_records=`wc -l < abc.txt`
echo "Trailer|$get_records"

Or:

get_records=$(( `wc -l < abc.txt` ))
echo "Trailer|$get_records"

Amazing i worked thats a ton Jhon!!! :b: U rock buddy I have seen many of your solutions on this forum and i used some of your logics as well Im ur fan folk !!! :b: cheers