Instead of searching a string in a file (SAM component monitor - number of strings found) I need only to get the first lind of a file on linux. Is there someone who could help me?
It can be done with the awk command/lenguage
head 1 <filename>
re-direct the output to a variable or array to process.
For example
cat textodeprueba.txt | awk 'NR==1'