awkの使用に問題があります。パラメータとして与えられたすべてのファイルから、長さが少なくとも 10 の行数を出力します。また、最初の 10 文字を除いて、その行の内容を出力します。ファイルの分析の最後に、ファイルの名前と行数を出力します。
これは私がこれまでに行ったことです:
{
if(length($0)>10)
{
print "The number of line is:" FNR
print "The content of the line is:" substr($0,10)
s=s+1
}
x= wc -l //number of lines of file
if(FNR > x) //this is supposed to show when the file is over but it's not working
{ //I also tried if (FNR == 1) - which means new file
print "This was the analysis of the file:" FILENAME
print "The number of lines with characters >10 are:" s
}
}
これにより、ファイルの名前と、少なくとも 10 文字の各行の後に行数が出力されますが、次のようなものが必要です。
print "The number of line is:" 1
print "The content of the line is:" dkhflaksfdas
print "The number of line is:" 3
print "The content of the line is:" asdfdassaf
print "This was the analysis of the file:" awk.txt
print "The number of lines with characters >10 are:" 2