The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 05-25-2007
happyv happyv is offline
Registered User
  
 

Join Date: Sep 2006
Posts: 209
delete and remain 2 value

Hello Friend,

I have the followint command to delete 4th field and move forward. Can I delete all filed and just remain the first 2?
sed -e "/^[ ]*<Number/s/\([^ ]\) \([^ ]\)/\1\2/g" -e "/^[ ]*<Number/s/\([0-9][0-9][0-9]\)./\1/" -e "/^[ ]*<Number/s/\([0-9][0-9]\)/\1 /g" -e "/^[ ]*<Number/s/0</</" file

input
<Number>00000000<Number>
<Number>0123456<Number>
<Number>4403459411<Number>

output
<Number>00<Number>
<Number>01<Number>
<Number>44<Number>