Search Results

Search: Posts Made By: tristezo2k
2,446
Posted By anbu23
$ echo $VAR1 | sed...
$ echo $VAR1 | sed 's/.//;s/[0-9]\([0-9]\{2\}\)$/\1/'
SOMETHING03
$ echo $VAR2 | sed 's/.//;s/[0-9]\([0-9]\{2\}\)$/\1/'
OTHERTHING04
2,446
Posted By Don Cragun
If you're using a 1993 or later version of the...
If you're using a 1993 or later version of the Korn shell:
#!/bin/ksh
VAR1="ISOMETHING103"
VAR2="COTHERTHING04"
printf "Initial VAR1=\"%s\", VAR2=\"%s\"\n" "$VAR1" "$VAR2"
VAR1=${VAR1/?/}...
2,446
Posted By Yoda
echo "ISOMETHING103" | awk ' { match...
echo "ISOMETHING103" | awk ' {
match ($0, /^[A-Z]*/)
printf substr($0, RSTART + 1, RLENGTH - 1)
match ($0, /[0-9]*$/)
print (RLENGTH >= 3 ? substr($0, RSTART + 1)...
2,446
Posted By Jotne
other awk echo ${VAR1:1} | awk...
other awk
echo ${VAR1:1} | awk '{l=length($0);m=match($0,/[0-9]/)} {if (l-m==2) {print substr($0, 1,m-1)substr($0, m+1,2)} else {print}}'
Showing results 1 to 4 of 4

 
All times are GMT -4. The time now is 11:59 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy