Extracting String from a list

I have a string of Data such as

Date Time Tran1 Tran2 Tran3 ......

How can I extract just all the trans excluding Date and Time.

Thanks,

Odogbolu98
:wink:

you can extract the tran by using awk command

pipe the list through awk, example

ls -l | awk '{print $3" "$4" "$5}'

or if the string of data is in a file you could cat the file
eg

cat filename | awk '{print $3" "$4" "$5}'

this will get Tran1 on colume 3, Tran2 on colume 4, & tran3 on colume 5.

Thanks Hassan, But the problem is that there are different numbers of trans involved. That is why I used continuation sign(...) There could be as many as 4 to 7 or even 1 trans. I would need a strict to extract the trans, irrespective of the number of trans involved.

Hope this explans the situation.

Odogbolu98

Try using the shell:

while read junk1 junk2 good_stuff
do
echo "$good_stuff"
done < your_file

Hi,

How about using

echo $line|tr -s " "|cut -d" " -f 3-

hope this solves the issue

rgds
penguin