Sponsored Content
Top Forums Shell Programming and Scripting Extract multiple entries between pattern Post 302353885 by vgersh99 on Wednesday 16th of September 2009 12:13:49 PM
Old 09-16-2009
Code:
echo 'Entity Action="Update" Type="Person" TradingPartnerId="" Status="Failure"' | nawk -F'"' '{for(i=2;i<=NF;i=i+2) printf("%s%s", $i, (i==NF-1)?ORS:" - ")}'



---------- Post updated at 12:13 PM ---------- Previous update was at 12:13 PM ----------

To keep the forums high quality for all users, please take the time to format your posts correctly.

First of all, use Code Tags when you post any code or data samples so others can easily read your code. You can easily do this by highlighting your code and then clicking on the # in the editing menu. (You can also type code tags [code] and [/code] by hand.)

Second, avoid adding color or different fonts and font size to your posts. Selective use of color to highlight a single word or phrase can be useful at times, but using color, in general, makes the forums harder to read, especially bright colors like red.

Third, be careful when you cut-and-paste, edit any odd characters and make sure all links are working property.

Thank You.

The UNIX and Linux Forums
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Extract the Pattern

Hello All, can anyone help me out in extracting the pattern from a file... The Input file is: NFS B.11.11 ONC/NFS; Network-FileSystem,InformationServices,Utilities|123 NParProvider B.11.11.01.04.01.01 nPartition Provider|456 NPartition A.01.02 Enhanced NPartition Commands/789... (6 Replies)
Discussion started by: aajan
6 Replies

2. Shell Programming and Scripting

pattern extract

Hi I have a pattern like : SYSTEM_NAME-232-S7-200810060949.LOG Here I need to extract system name and the timestamp and also the numeric number after "-S" i.e 7 here . I am not very sure of whether I should use sed / awk for this ?:confused: Thanks, Priya. (6 Replies)
Discussion started by: priyam
6 Replies

3. Shell Programming and Scripting

sed: Find start of pattern and extract text to end of line, including the pattern

This is my first post, please be nice. I have tried to google and read different tutorials. The task at hand is: Input file input.txt (example) abc123defhij-E-1234jslo 456ujs-W-abXjklp From this file the task is to grep the -E- and -W- strings that are unique and write a new file... (5 Replies)
Discussion started by: TestTomas
5 Replies

4. Shell Programming and Scripting

extract multiple cloumns from multiple files; skip rows and include filenames; awk

Hello, I am trying to write a bash shell script that does the following: 1.Finds all *.txt files within my directory of interest 2. reads each of the files (25 files) one by one (tab-delimited format and have the same data format) 3. skips the first 10 rows of the file 4. extracts and... (4 Replies)
Discussion started by: manishabh
4 Replies

5. Shell Programming and Scripting

need help with post:extract multiple columns from multiple files

hello, I will would be grateful if anyone can help me reply to my post extract multiple cloumns from multiple files; skip rows and include filenames; awk Please see this thread. Thanks manishabh (0 Replies)
Discussion started by: manishabh
0 Replies

6. Shell Programming and Scripting

Search for a pattern,extract value(s) from next line, extract lines having those extracted value(s)

I have hundreds of files to process. In each file I need to look for a pattern then extract value(s) from next line and then search for value(s) selected from point (2) in the same file at a specific position. HEADER ELECTRON TRANSPORT 18-MAR-98 1A7V TITLE CYTOCHROME... (7 Replies)
Discussion started by: AshwaniSharma09
7 Replies

7. Shell Programming and Scripting

Extract a pattern from multiple lines in a file

I have a file that has some lines starts with * I want to get these lines, then get the word between "diac" and "lex". ex. file: ;;WORD AlAx *0.942490 diac:Al>ax lex:>ax_1 bw:Al/DET+>ax/NOUN+ gloss:brother pos:noun prc3:0 prc2:0 prc1:0 prc0:Al_det per:na asp:na vox:na mod:na gen:m num:s... (4 Replies)
Discussion started by: Viernes
4 Replies

8. Shell Programming and Scripting

Need pattern Extract

2014-05-31-18.22.18.500158-240 E11115478A502 LEVEL: Info PID : 25100668 TID : 73282 PROC : db2sysc 0 INSTANCE: udbin001 NODE : 000 DB : APPHDL : 0-18345 APPID: *LOCAL.udbin001.140531200018 AUTHID : udbin001 EDUID : 73282 ... (4 Replies)
Discussion started by: ilugopal
4 Replies

9. Shell Programming and Scripting

Match Pattern and print pattern and multiple lines into one line

Hello Experts , require help . See below output: File inputs ------------------------------------------ Server Host = mike id rl images allocated last updated density vimages expiration last read <------- STATUS ------->... (4 Replies)
Discussion started by: tigerhills
4 Replies

10. Shell Programming and Scripting

Extract whole word preceding a specific character pattern with first occurence of the pattern

Hello. Here is a file contents : declare -Ax NEW_FORCE_IGNORE_ARRAY=(="§" ="§" ="§" ="§" ="§" .................. ="§"Here is a pattern =I want to extract 'NEW_FORCE_IGNORE_ARRAY' which is the whole word before the first occurrence of pattern '=' Is there a better solution than mine :... (3 Replies)
Discussion started by: jcdole
3 Replies
ICEAUTH(1)						      General Commands Manual							ICEAUTH(1)

NAME
iceauth - ICE authority file utility SYNOPSIS
iceauth [ -f authfile ] [ -vqib ] [ command arg ... ] DESCRIPTION
The iceauth program is used to edit and display the authorization information used in connecting with ICE. This program is usually used to extract authorization records from one machine and merge them in on another (as is the case when using remote logins or granting access to other users). Commands (described below) may be entered interactively, on the iceauth command line, or in scripts. OPTIONS
-f authfile Name of the authority file to use. Will default to the file currently in use by the session. -v Turns on extra messages (verbose mode) -q Turns off extra messages (quiet mode) -i Ignore the locks on the authority file -b Break the locks on the authority file -u Print basic usage instructions USAGE
When iceauth is run it will allow the following set of commands to be entered interactively or in scripts. ? List available commands. help Print help information. You may supply a command name to help to get specific information about it. info Print information about the entries in the authority file. list List (print) entries in the authority file. You may specify optional modifiers as below to specify which entries are listed. list [ protocol_name ] [ protocol_data ] [ netid ] [ authname ] add Add an entry to the authority file. This must be in the format add protocol_name protocol_data netid authname authdata remove Remove entries from the authority file. remove [ protocol_name ] [ protocol_data ] [ netid ] [ authname ] extract Extract entries from the authority file in to a destination file. You must supply the path to the destination to this command as in the following format. Optional specifiers allow you to narrow which entries are extracted. extract filename [ protocol_name ] [ protocol_data ] [ netid ] [ authname ] merge Merge entries from other files in to the authority file selected by the program. You may supply any number of file paths to this command as follows: merge filename1 [ filename2 ] [ filename3 ] ... exit Save changes and exit the program. quit Abort changes and exit the program without saving. source Read and execute commands from a file. source filename AUTHOR
Ralph Mor, X Consortium X Version 11 iceauth 1.0.5 ICEAUTH(1)
All times are GMT -4. The time now is 09:39 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy