0

When operating in the linux terminal I can enter the following: command

''' awk 'FNR==1 {print$5}' SNextractedstats.txt '''

To display the value in the first row and fifth column of a text file.

I would like to be able to save this value as a variable in a bash script to be able to do sums and call using Echo, how would I go about doing this? Thank you

1 Answers1

1

Read man bash or https://manpages.ubuntu.com/manpages/bionic/en/man1/bash.1.html an do something like

myvar="$(awk 'FNR==1 {print$5}' SNextractedstats.txt)"
waltinator
  • 37,856