Register
It is currently Sun Apr 22, 2018 9:56 pm

print string


All times are UTC - 6 hours


Post new topic Reply to topic  [ 6 posts ] 
Author Message
 PostPosted: Wed Feb 28, 2018 4:53 am   

Joined: Wed Feb 28, 2018 4:29 am
Posts: 4
Hello

i have i file like this:

360000970000297800262533030413242
0x50000975a8041844
0x50000975a8041804
0x50000975a80418c4
0x50000975a8041884
360000970000297800262533030413235
0x50000975a80418c4
0x50000975a8041884
0x50000975a8041844
0x50000975a8041804
360000970000297800262533030413237
0x50000975a8041844
0x50000975a8041884
0x50000975a80418c4
0x50000975a8041804
360000970000297800262533030413241
0x50000975a8041844
0x50000975a8041804
0x50000975a80418c4
0x50000975a8041884
360000970000297800262533030413236
0x50000975a80418c4
0x50000975a8041884
0x50000975a8041844
0x50000975a8041804
360000970000297800262533030413243
0x50000975a8041844
0x50000975a8041804
0x50000975a80418c4
0x50000975a8041884
360000970000297800262533030413239


i want output, for example, only the lun id that have path 0x50000975a8041884 :

360000970000297800262533030413236
0x50000975a8041884
360000970000297800262533030413237
0x50000975a8041884

etc

its possible?

tnx


Top
 Profile  
 PostPosted: Wed Feb 28, 2018 2:29 pm   

Joined: Mon Oct 20, 2014 9:53 am
Posts: 574
Code:
input_file=/path/to/your/inputfile

selector="0x50000975a8041884"
sed -rn '/^[[:digit:]]{33}/{H;n
                            /'"$selector"'/H;n
                            /'"$selector"'/H;n
                            /'"$selector"'/H;n
                            /'"$selector"'/H;                       
                            s/.*//;
                            x;
                            /'"$selector"'/p
                            s/.*//
                           }
        ' $input_file


Top
 Profile  
 PostPosted: Thu Mar 01, 2018 3:52 am   

Joined: Wed Feb 28, 2018 4:29 am
Posts: 4
uhelp wrote:
Code:
input_file=/path/to/your/inputfile

selector="0x50000975a8041884"
sed -rn '/^[[:digit:]]{33}/{H;n
                            /'"$selector"'/H;n
                            /'"$selector"'/H;n
                            /'"$selector"'/H;n
                            /'"$selector"'/H;                       
                            s/.*//;
                            x;
                            /'"$selector"'/p
                            s/.*//
                           }
        ' $input_file


tnx for the script.

we need to filter the results whit all the wwn (ex 360000970000297800262533030413237) that contains only one path ex:

360000970000292604030533030313434
0x50000974083ef965
0x50000974083ef959
0x50000974083ef95d
0x50000974083ef961
360000970000297800262533030303031
0x50000975a8041804

from this output we need just :

360000970000297800262533030303031
0x50000975a8041804

please notice the output can contains different wwn and path


tnx in advice


Top
 Profile  
 PostPosted: Thu Mar 01, 2018 11:08 am   

Joined: Mon Oct 20, 2014 9:53 am
Posts: 574
I'd say, it alredy does this.
Post a proper input file so i can test it.


Top
 Profile  
 PostPosted: Tue Mar 06, 2018 8:07 am   

Joined: Wed Feb 28, 2018 4:29 am
Posts: 4
uhelp wrote:
I'd say, it alredy does this.
Post a proper input file so i can test it.


hi

the previous script dont do what i want.


i have this output:

360000970000297800262533030413242
0x50000975a8041844
0x50000975a8041804
0x50000975a80418c4
0x50000975a8041884
360000970000297800262533030413235
0x50000975a80418c4
0x50000975a8041884
0x50000975a8041844
0x50000975a8041804
360000970000297800262533030413237
0x50000975a8041844
0x50000975a8041884
0x50000975a80418c4
0x50000975a8041804
360000970000297800262533030413241
0x50000975a8041844
0x50000975a8041804
0x50000975a80418c4
0x50000975a8041884
360000970000297800262533030413236
0x50000975a80418c4
0x50000975a8041884
0x50000975a8041844
0x50000975a8041804
360000970000297800262533030413243
0x50000975a8041844
0x50000975a8041804
0x50000975a80418c4
0x50000975a8041884
360000970000297800262533030413239
0x50000975a80418c4
0x50000975a8041884
0x50000975a8041844
0x50000975a8041804
360000970000297800262533030413337
0x50000975a80418c4
360000970000292604030533032334633
0x50000975a80418c4
0x50000975a8041884
0x50000975a8041844
0x50000975a8041804
360000970000297800262533030413238
0x50000975a80418c4
0x50000975a8041884
0x50000975a8041844
0x50000975a8041804
360000970000292604030533030313434
0x50000974083ef965
0x50000974083ef959
0x50000974083ef95d
0x50000974083ef961
360000970000297800262533030303031
0x50000975a8041804
360000970000292604030533032334443
0x50000975a80418c4
0x50000975a8041884
0x50000975a8041844
0x50000975a8041804
360000970000292604030533032334335
0x50000975a80418c4
0x50000975a8041884
0x50000975a8041844
0x50000975a8041804


from this i want filter only the lun whit 1 path (this path can change):

360000970000297800262533030303031
0x50000975a8041804

360000970000297800262533030413337
0x50000975a80418c4

tnx


Top
 Profile  
 PostPosted: Tue Mar 06, 2018 9:15 am   

Joined: Mon Oct 20, 2014 9:53 am
Posts: 574
uhelp wrote:
....Post a proper input file so i can test it.


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Google [Bot] and 25 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP