can anyone explain this codes here?

nawk 'FNR > 3 {printf("%s%c", $0, OFS)}END{print ""}' "$1" > "$1".out && mv "$1
".out "$1"

what is FNR? or printf("%s%c",$0, OFS)}?

sorry..im lost...

The FNR variable contains the number of lines read, but is reset for each file read. The NR variable accumulates for all files read. Therefore if you execute an awk script with two files as arguments, with each containing 10 lines:

nawk '{print NR}' file file2
nawk '{print FNR}' file file2

the first program would print the numbers 1 through 20, while the second would print the numbers 1 through 10 twice, once for each file.

printf is used to print the output into the file instead of screen. inside the printf %s is used for string printing and %c is used for character printing. that is $0 as string and OFS is out field separator as character other then space which is default.

Joins all lines starting at line 4

FNR > 3 { ... }
Execute code ... starting at line 4 of currrent file.
Lines 1 to 3 are ignored.
FNR = The number of the current input record in the current file

printf("%s%c",$0, OFS)}
Print current input record followed by record separator (no line feed at end)
OFS = The output field separator (default is a space)

END{ ... }
Execute code ... when all input records has been read

print ""
Print only one line feed

Input file:
line1
line2
line3
line4
line5

Result file (one record length):
line4 line4