Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

bash return length of every nth row

# Basic syntax:
awk '(FNR%4==0) {print length($0)}' your_file.txt > trimmed_file.txt
# Where:
#	- FNR is the current file record number (typically the line number)
#	- (FNR%4==0) checks whether the current line number is evenly divisible by
#		4, to get the length of every 4th row
#	- For line numbers that are evenly divisible by 4, get the length with the
# 		awk length function
 
PREVIOUS NEXT
Tagged: #bash #return #length #nth #row
ADD COMMENT
Topic
Name
6+8 =