Search Results

Search: Posts Made By: desant
1,098
Posted By RudiC
In case we're dealing with shell variables, try ...
In case we're dealing with shell variables, try

X="19 34 44 49 64"
PT=34
LX=${X%% ${PT}*}
RX=${X##*${PT} }
echo ${LX##* }, ${RX%% *}
19, 44
1,098
Posted By RudiC
Is that line in a file? A shell variable? Try ...
Is that line in a file? A shell variable? Try

tr ' ' $'\n' < file | grep -C1 34
19
34
44or
echo $X | tr ' ' $'\n' | grep -C1 34
19
34
44Those $'\n' are bashisms; replace with ksh's...
647
Posted By RudiC
awk is not necessary, nor is any other utility....
awk is not necessary, nor is any other utility. Try also pure shell:
TMP=${DIR#${DIR%%px[0-9]*[^/]/*}px}
echo ${TMP%%/*}
347
647
Posted By RavinderSingh13
Hello desant, Could you please try following...
Hello desant,

Could you please try following and let us know if this helps you.

cat script1.ksh
DIR="/ts/pod/px/px347/config/pxedbsvc.cfg"
echo $DIR | awk -F"/" '{for(i=1;i<=NF;i++){if($i ~...
Showing results 1 to 4 of 4

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