The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM



Thread: reading lines
View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #4 (permalink)  
Old 05-17-2008
jaduks's Avatar
jaduks jaduks is offline
Registered User
 

Join Date: Aug 2007
Location: Assam,India
Posts: 141
Era's solution helped me to find two more similar ways . Thank you Era.

Code:
$ sed -n '3 s/\(.\{3\}\).*/\1/p' test.txt
thr

$ awk 'NR==3 {print substr($0,1,3)}' test.txt
thr
//Jadu
Reply With Quote