The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 11-21-2008
zaxxon's Avatar
zaxxon zaxxon is offline Forum Staff  
Moderator
  
 

Join Date: Sep 2007
Location: Germany
Posts: 2,289
awk and sed examples:

Code:
echo "ECR/CHQ/GBP/12345.out"| sed 's!^\([^\/]*\/[^\/]*\/[^\/]*\)\/.*!\1!'
ECR/CHQ/GBP

echo "ECR/CHQ/GBP/12345.out"| awk -F/ 'BEGIN{OFS="/"} {print $1,$2,$3}'
ECR/CHQ/GBP