Sponsored Content
Top Forums UNIX for Advanced & Expert Users How to extract two words at the same time. Post 302190630 by Aejaz on Wednesday 30th of April 2008 05:41:22 AM
Old 04-30-2008
How to extract two words at the same time.

Hi, Can anyone please let me know, how to extract two lines at the same time. In specific,I have a file containing list of devices, such as router1 and switch2 below. I want to get all the lines which has "#" and all the lines which has "down"


router1#sh ip int br
Interface IP-Address OK? Method Status Protocol^M
Vlan1 unassigned YES NVRAM up down ^M
Vlan100 10.71.12.202 YES NVRAM up up ^M
FastEthernet0/1 unassigned YES unset down down ^M
GigabitEthernet0/1 unassigned YES unset up up ^M
GigabitEthernet0/2 unassigned YES unset up up ^M
router1#
router1#exit

switch2#^M
switch2#term length 0^M
switch2#sh ip int br^M
Interface IP-Address OK? Method Status Protocol^M
Vlan1 unassigned YES NVRAM up down ^M
Vlan400 10.71.12.206 YES NVRAM up up ^M
GigabitEthernet0/1 unassigned YES unset up down ^M
GigabitEthernet0/2 unassigned YES unset up up ^M
switch2#^M




I am expected to get the output as:



router1#sh ip int br^M
Vlan1 unassigned YES NVRAM up down ^M
FastEthernet0/1 unassigned YES unset down down ^M
router1#
router1#exit


switch2#^M
switch2#term length 0^M
switch2#sh ip int br^M
Vlan1 unassigned YES NVRAM up down ^M
GigabitEthernet0/1 unassigned YES unset up down ^M
switch2#^M



Regards,A

Last edited by Aejaz; 04-30-2008 at 07:12 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

extract words with even numbr of letters

Hello All I need to extract words which are of even number of letters and not greater than 10. Any help?? Thanks, Manish (3 Replies)
Discussion started by: manish205
3 Replies

2. Shell Programming and Scripting

Extract numbers below words with awk

Hi all, Please some help over here. I have a Sales.txt file containing info in blocks for every sold product in the pattern showed below (only for 2 products). NEW BLOCK SALE DATA PRODUCT SERIAL 79833269999 146701011945004 .Some other data .Some... (17 Replies)
Discussion started by: cgkmal
17 Replies

3. Shell Programming and Scripting

extract words from txt using perl

Hi, i will deal with txt file and i want to use perl to extract number of words from this txt ex :if the txt file is a story which contains person names and iwant to extract these names and there is something else that these names which i want perl to extract must match the words (person names) ... (2 Replies)
Discussion started by: eng_shimaa
2 Replies

4. Shell Programming and Scripting

[sed] extract words from a string

Hi, One of the scripts creates logs in the format: progname_file1.log.20100312020657 where after file the number could be from 1 to 28 and after log. the date is attached in the format YYYYMMDDHHMISS progname_file<1-28>.log.YYYYMMDDHHMISS. Now I want to discard the .20100312020657... (7 Replies)
Discussion started by: dips_ag
7 Replies

5. Shell Programming and Scripting

expr command to extract words

how to use expr command to retrieve all the words before the equal sign "=" with shell script (3 Replies)
Discussion started by: 76455
3 Replies

6. UNIX for Dummies Questions & Answers

Extract words to new file

Hi there, Unix Gurus Working with big listings of english sentences for my pupils, of the type: 1. If the boss's son had been , someone would have asked for money by now. 2. Look, I haven't a crime, so why can't you let me go? .... I wondered how to extract the words between brackets in... (7 Replies)
Discussion started by: eldeingles
7 Replies

7. Shell Programming and Scripting

Extract words from a pipe

Hello, Currently, I have this output from my application : ------------------------------------------------- Log viewer/Tmp1 (Jun 29 2011 09:48) ------------------------------------------------- BlalbalbaBlalbalba..Blalbalba..Blalbalba..Blalbalba..Blalbalba..Blalbalba..Blalbalba....... (3 Replies)
Discussion started by: acidoangel
3 Replies

8. Shell Programming and Scripting

Extract data b/w two words using sed

Hi, I want to extract data b/w two words with the help of sed.. Eg: In "Anna said that she would fetch the bucket", I want to display data b/w "Anna" and "would" O/P: said that she I have tried with below code, but unable to get desired o/p echo "Anna said that she would fetch the... (5 Replies)
Discussion started by: divya bandipotu
5 Replies

9. Shell Programming and Scripting

Extract words before and after a certain word.

I have a sample text file with file name: sample.txt The text file has the following text. this is an example text where we have to extract certain words before and after certain word these words can be used later to get more information I want to extract n (a constant) words before and... (2 Replies)
Discussion started by: shoaibjameel123
2 Replies

10. UNIX for Beginners Questions & Answers

Extract Bracketed Words

Hi there, Unixers I need to extract ALL the words from a text which aresurrounded by square brackets. I am using this piece of code sed 's/.*\.*/\1/g' inputfile > outputfile but I only get one word for every paragraph, why? Please use CODE tags as required by forum rules! (7 Replies)
Discussion started by: eldeingles
7 Replies
tpm_nvdefine(8) 														   tpm_nvdefine(8)

NAME
tpm_nvdefine SYNOPSIS
tpm_nvdefine [OPTIONS] DESCRIPTION
tpm_nvdefine defines a new NVRAM area at the given index and of given size. The user has to provide the permissions that control access to the NVRAM area. Owner authentication is necessary once the NVRAM area 0xFFFFFFFF has been defined. The owner password may be provided on the command line using the owner password option. The following options are supported: -h, --help Display command usage info. -v, --version Display command version info. -l, --log [none|error|info|debug] Set logging level. -u, --unicode Use TSS UNICODE encoding for passwords to comply with applications using TSS popup boxes -y, --owner-well-known Use a secret of all zeros (20 bytes of zeros) as the owner's secret. -z, --area-well-known Use a secret of all zeros (20 bytes of zeros) as the NVRAM area's secret. -o, --pwdo (optional parameter) The owner password. A password may be directly provided for example by using '--pwdo=password' or '-opassword'. If no password is provided with this option then the program will prompt the user for the password. -a, --pwda (optional parameter) The NVRAM area password. A password may be directly provided for example by using '--pwda=password' or '-apassword'. If no password is provided with this option then the program will prompt the user for the password. -i, --index The index of the NVRAM area. The parameter must either be a decimal number or a hexadecimal number starting with '0x'. To select the NVRAM area with index 0x100, the command line parameter should be '-i 0x100' or '--index 0x100'. -s, --size The size of the NVRAM area. The parameter must either be a decimal number or a hexadecimal number starting with '0x'. -p, --permissions The access permissions associated with the NVRAM area. The parameter must either be a decimal number or a hexadecimal number staring with '0x'. It is possible to logically 'or' numbers or strings. The following strings are supported: AUTHREAD Reading requires NVRAM area authorization. AUTHWRITE Writing requires NVRAM area authorization. PPREAD Reading requires physical presence. PPWRITE Writing requires physical presence. OWNERREAD Reading requires owner authorization. OWNERWRITE Writing requires owner authorization. GLOBALLOCK A write to index 0 locks the NVRAM area until the next TPM_Startup(ST_CLEAR) READ_STCLEAR A read with size 0 on the same index prevents further reading until the next TPM_Startup(ST_CLEAR) WRITE_STCLEAR A write with size 0 to the same index prevents further writing until the next TPM_Startup(ST_CLEAR) WRITEDEFINE A write with size 0 to the same index locks the NVRAM area permanently WRITEALL The value must be written in a single operation An example of a permission parameter is: --permissions="OWNERREAD|OWNERWRITE" SEE ALSO
tpm_nvread(8), tpm_nvwrite(8), tpm_nvrelease(8), tpm_nvinfo(8) REPORTING BUGS
Report bugs to <trousers-users@lists.sourceforge.net> TPM Management 2011-07-07 tpm_nvdefine(8)
All times are GMT -4. The time now is 01:06 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy