Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  • Users: emike
  • Order by date
  1. emike

    how to cut last 4 characters in file using shell script

    line="1234567890abcd" This command will print out 1234567890 echo $line | awk '{print substr($0,1, length($0)-4)}' This command will print out 0abcd echo $line | awk '{print substr($0,length($0)-4)}' Note: substr( String, M, [ N ] ) Returns a substring with the number of characters...
  2. emike

    how to cut last 4 characters in file using shell script

    Luckily my file won't contain any more than one dot. I found some code involving awk, substr and length which I will have a look at and see if I can get it to work. I'm from a VMS/DCL background and just starting in Unix Shell scripting. This sort of think is really easy in VMS/DCL.
  3. emike

    how to cut last 4 characters in file using shell script

    wsFilePath="/myfile/tmp/ParList.dat" wsFile=`basename $wsFilePath| cut -d. -f1` this worked for me. baseline returns the filename from the full filename and path. This is then piped through cut which splits the string by delimited . (That's the -d.) Field 1 is returned which is the filename...

Part and Inventory Search

Back
Top