1752755 Members
5159 Online
108789 Solutions
New Discussion юеВ

extract a world

 
SOLVED
Go to solution
iranzo
Frequent Advisor

extract a world

Hello,
on an HPUX ksh
we want to extract a string (a word)
who contain "*/*"
in a file like this :
8 00-01-e6-40-a3-70 2/6 [ALL]
8 0001.e640.a370 DYNAMIC Fa0/7
0001.e640.a370 Dynamic 8 FastEthernet0/5
to obtain this :
2/6
Fa0/7
Fastethernet0/5

Thank's a lot
Bonjour
3 REPLIES 3
iranzo
Frequent Advisor

Re: extract a world

Sorry,
error in subject :
read this extract a word
Bonjour
James R. Ferguson
Acclaimed Contributor

Re: extract a world

Hi Izanzo:

# perl -lne '@list=split;foreach (@list) {print while $_=~m%/%g'} file

Regards!

...JRF...
James R. Ferguson
Acclaimed Contributor
Solution

Re: extract a world

Hi (again) Iranzo:

Oh, no perl, just 'ksh'. OK:

#!/usr/bin/ksh
while read LINE
do
for X in ${LINE}
do
case ${X} in
*/* ) echo ${X}
;;
esac
done
done < file
exit 0

Regards!

...JRF...