Sponsored Content
Top Forums UNIX for Dummies Questions & Answers How to print line starts with specific word and contains specific word using sed? Post 302562837 by tmalik79 on Saturday 8th of October 2011 01:40:16 PM
Old 10-08-2011
Here is what i am trying to achieve..

I want print the data or create file line starts with '<MAPPING ' and contains 'NAME=$variable1' anywhere in the line and other line with </MAPPING>. This is to print the data from between lines. $variable is parameter and i can have one or more lines in between.

Example of the code.
Code:
<MAPPING DESCRIPTION ='' ISVALID ='YES' NAME='m_TASK_UPDATE' OBJECTVERSION ='1'>
<ATTRIBUTE1></ATTRIBUTE1>
<ATTRIBUTE2></ATTRIBUTE2>
<ATTRIBUTE3></ATTRIBUTE3>
</MAPPING>
<MAPPING DESCRIPTION ='' ISVALID ='NO' NAME='m_WFS_LIST' OBJECTVERSION ='1'>
<ATTRIBUTE1></ATTRIBUTE1>
<ATTRIBUTE2></ATTRIBUTE2>
<ATTRIBUTE3></ATTRIBUTE3>
<ATTRIBUTE4></ATTRIBUTE4>
<ATTRIBUTE5></ATTRIBUTE5>
<ATTRIBUTE6></ATTRIBUTE6>
</MAPPING>

Appreciate your help in this regard.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Can "sed" substitute word on a specific line?

Hello experts, I know line number of the word I want to replace. Can "sed" substitute word on a specific line? As well, can sed substitute words inside a specific patten. ex. <word>lalala</word> #replace anything between <word> and </word> minifish (2 Replies)
Discussion started by: minifish
2 Replies

2. Shell Programming and Scripting

Print a word specific number of times

Hi All, I wanted to know if there is a shell command to print a word n number of times The Input File is : Cat 4 Bat 3 Zall 1 Kite 2 Output File required is : Cat Cat Cat Cat Bat Bat Bat Zall Kite (4 Replies)
Discussion started by: sam_2921
4 Replies

3. Shell Programming and Scripting

awk or sed command to print specific string between word and blank space

My source is on each line 98.194.245.255 - - "GET /disp0201.php?poc=4060&roc=1&ps=R&ooc=13&mjv=6&mov=5&rel=5&bod=155&oxi=2&omj=5&ozn=1&dav=20&cd=&daz=&drc=&mo=&sid=&lang=EN&loc=JPN HTTP/1.1" 302 - "-" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.0.3705; .NET CLR... (5 Replies)
Discussion started by: elamurugu
5 Replies

4. Shell Programming and Scripting

search-word-print-specific-string

Hi, Our input xml looks like: <doc> <str name="account_id">1111</str> <str name="prd_id">DHEP155EK</str> </doc> - <doc> <str name="account_id">6666</str> <str name="prd_id">394531662</str> </doc> - <doc> <str name="account_id">6666</str> <str... (1 Reply)
Discussion started by: Jassz
1 Replies

5. Shell Programming and Scripting

break the string and print it in a new line after a specific word

Hi Gurus I am new to this forum.. I am using HP Unix OS. I have one single string in input file as shown below Abc123 | cde | fgh | ghik| lmno | Abc456 |one |two |three | four | Abc789 | five | Six | seven | eight | Abc098 | ........ I want to achive the result in a output file as shown... (3 Replies)
Discussion started by: kannansr621
3 Replies

6. UNIX for Dummies Questions & Answers

How to print the specific word in a file.

Hi , My input file is below like that :- $cat abc.txt Service name: test_taf Service is enabled Server pool: test_tac Cardinality: 2 Disconnect: false Service role: PRIMARY Management policy: AUTOMATIC DTP transaction: false AQ HA notifications: true Failover type: SESSION... (3 Replies)
Discussion started by: sp001
3 Replies

7. Shell Programming and Scripting

sed / awk to get specific word in line

I have http log that I want to get words after specific "tag", this a sample line from the log: 98,POST,200 OK,www.facebook.com,Mozilla/5.0 (Windows NT 6.1; WOW64; rv:9.0.1) Gecko/20100101 Firefox/9.0.1,/ajax/updatestatus.php?__a=1,datr=P_H1TgjTczCHxiGwdIF5tvpC; lu=Si1fMkcrU2SInpY8tk_7tAnw;... (6 Replies)
Discussion started by: erlanq
6 Replies

8. Shell Programming and Scripting

How to print multiple specific column after a specific word?

Hello.... Pls help me (and sorry my english) :) So I have a file (test.txt) with 1 long line.... for example: isgc jsfh udgf osff 8462 error iwzr 653 idchisfb isfbisfb sihfjfeb isfhsi gcz eifh How to print after the "error" word the 2nd 4th 5th and 7th word?? output well be: 653 isfbisfb... (2 Replies)
Discussion started by: marvinandco
2 Replies

9. Shell Programming and Scripting

Search for a specific word and print only the word from the input file

Hi, I have a sample file as shown below, I am looking for sed or any command which prints the complete word only from the input file. Ex: $ cat "sample.log" I am searching for a word which is present in this file We can do a pattern search using grep but I need to cut only the word which... (1 Reply)
Discussion started by: mohan_kumarcs
1 Replies

10. Shell Programming and Scripting

In Vi "sed" substitute word on a specific line

i need to substitute word on a specific line. I was able to do it on command line like below but it is not working in vi. command line like below: sed -e '8s/table_name/schema.table_name/' file_name. in vi table_name and schema are my positional parameters that i pass into the script. ... (5 Replies)
Discussion started by: pimmit22043
5 Replies
asadmin-start-domain(1AS)					   User Commands					 asadmin-start-domain(1AS)

NAME
asadmin-start-domain, start-domain - starts the given domain SYNOPSIS
start-domain [--domaindir install_dir/domains] [--terse=false] [--echo=false] [--verbose=false] [--debug] [domain_name] start-domain starts the specified domain. If there is only one domain in the default domain directory (install_dir/domains), then no oper- and is required to start the domain. However, if there is more than one domain, the domain operand must be specified. This command can only be run locally. OPTIONS
--domaindir directory where the domain is to be started. If specified, path must be accessible in the filesystem. If not speci- fied, the domain is started in the default install_dir/domains directory. --terse indicates that any output data must be very concise, typically avoiding human-friendly sentences and favoring well- formatted data for consumption by a script. Default is false. --echo setting to true will echo the command line statement on the standard output. Default is false. --verbose by default this flag is set to false. If set to true, detailed server startup output is displayed. Press CTRL-C to kill the server. Press CTRL- to print a thread dump. --debug by default this flag is set to false. If set to true, the server is started in debug mode and prints the JPDA port on the console. OPERANDS
domain_name name of the domain. Must be a unique name. Example 1: Using start-domain asadmin> start-domain sampleDomain Starting Domain sampleDomain, please wait. Domain sampleDomain started Where: the sampleDomain domain is started. EXIT STATUS
0 command executed successfully 1 error in executing the command asadmin-create-domain(1AS), asadmin-delete-domain(1AS), asadmin-stop-domain(1AS), asadmin-list-domains(1AS) J2EE 1.4 SDK March 2004 asadmin-start-domain(1AS)
All times are GMT -4. The time now is 04:10 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy