In my folder, I have 2000 files, which are labeled A0001-A2000. In the second line of each file, there is a long (it should be the longest) line of characters. I would like to print all the file names with the length of the second line in one output.
so the output will look something like
A0001 231
A0002 123
A0003 56
If it is helpful I already have a code that will print the longest line of a file, but I am not tied to using awk if there is an easier way.
$ awk '{print length}' A0001.txt |sort -nr|head -1
231
Find and print the length of the longest line
while your text saysprint all the file names with the length of the second line
which elsewhere you say should be the longest so it's not clear what you want output if/when the 2nd line isnt the longest.