Help in understanding the following commands

Hi ,

Please help me in understanding the below commands

temp="$dirname.temp.cc.$$"
This will eliminate any trailing white spaces???

k=$(grep -cvE " |\+|-|0|1|\f" $temp

if (substr(file,2,24) ~ /[0-9]{13,}/) {print "N" file} -- this is inside an awk script

Hi,

$$ stands for process id of the running process. To include this in a filename is a way of making the file or directory unique.

The second expression is missing a closing parenthesis. But it set k to the number of lines that do not contain the characters " ", "+", "-","0", "1" or formfeed. Whether the formfeed detection will work depends on your version of grep. If it doesn't then this code will also exclude lines that contain the character "f" from the count and that probably is not what was intended.

The third expression means if the 24 characters starting at position 2 in the variable "file" contain 13 or more digits then print the character "N" concatenated by the content of the variable "file" .

hey thanks very much...

if (substr(file,2,24) ~ /[0-9]{13,}/) {print "N" file}

please let me know if my understanding of the above line is correct.

the substr takes the charcters 2 to 24 inclusive, and checks 13 consecutive digits??
if its present, then print precede "N"to that line

Almost correct. 13 or more digits.

thanks very much!!