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 UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #3 (permalink)  
Old 09-24-2007
radoulov's Avatar
radoulov radoulov is offline
addict
 

Join Date: Jan 2007
Location: Milano, Italia/Варна, България
Posts: 2,020
You can do it all in shell
(without calling external utilities, like sed for example), but it depends on your ksh version.
Is N in fixed or variable position?
One or many occurrences?

With ksh93(dtksh on Solaris):

Code:
$ print ${.sh.version}
Version M 1993-12-28 r
$ v="N557788"
$  print -- ${v/N/-}
-557788
For older versions of ksh the solution depends on the answers of the above questions.
Reply With Quote