Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

print the content of file according to the size of line

#!/bin/bash

while read x; do 
	## print the number of words and then the line it self 
    ## add it to a temp file 
	echo "$(echo $x | wc -w) $x" >> temp.txt
done < $1 ## expecting an argument passed 

# sort in numerical order, and then print from the second field forward  
sort -n temp.txt | cut -f2- -d" "

 
PREVIOUS NEXT
Tagged: #print #content #file #size #line
ADD COMMENT
Topic
Name
3+2 =