To Get 1st record from 1st file from list of files

Hi

I am trying this cmd and getting

1st file path from list of files(abc2020.txt, abc1010.txt,abc3030.txt):

ls /grid/abc*.txt | head -1

Result for above cmd:

/grid/abc1010.txt

From the this file /grid/abc1010.txt, I need to get 1st record on it.

Data in the file will look like below

10,20,vddd,ee
20,30,gggg,yy

Please help me to solve this as it is crucial to me.

read RECORD < /grid/abc1010.txt

echo "The first record in /grid/abc1010.txt is '${RECORD}'"
head -1 `ls /grid/abc*.txt | head -1`
1 Like

Thank you very much. I will try it.