Sponsored Content
Top Forums Shell Programming and Scripting Parsing XML using command line Post 302949943 by cjcox on Friday 17th of July 2015 07:05:35 PM
Old 07-17-2015
Should work.

I put your xml into a file and this what I got:

Code:
sed -n 's/.*saw:user name="\([^"]*\).*/\1/p' <myfile.xml
mbussey@xyz.com
kimmy.chan@pqr.com
chudgins@gmail.com

(I'm just using the simple case of one pattern)

And modified to add the email code tags:

Code:
sed -n 's/.*saw:user name="\([^"]*\).*/[email]\1\[\/email]/p' <myfile.xml
[email]mbussey@xyz.com[/email]
[email]kimmy.chan@pqr.com[/email]
[email]chudgins@gmail.com[/email]

Note: on the unix forums the "bbcode" like tags are interpreted... so you won't see the email tags come out here.

Moderator's Comments:
Mod Comment You can use the NP button to create tags (or [NOPARSE]...[/NOPARSE] tags) to stop interpretation of other tags between them.

Last edited by Don Cragun; 07-17-2015 at 08:19 PM.. Reason: Make the email tags visible.
This User Gave Thanks to cjcox For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Parsing the command line arguments

Is there a way to get the command line arguments. I am using getopt(3) but if the arguments are more than one for a particular option than it just ignores the second argument. For eg ./a.out -x abc def now abd will be got with -x using getopt "( x : )" and string abc\0def will get stored... (7 Replies)
Discussion started by: jayakhanna
7 Replies

2. UNIX for Dummies Questions & Answers

command line argument parsing

how to parse the command line argument to look for '@' sign and the following with '.'. In my shell script one of the argument passed is email address. I want to parse this email address to look for correct format. rmjoe123@hotmail.com has '@' sign and followed by a '.' to be more... (1 Reply)
Discussion started by: rmjoe
1 Replies

3. Shell Programming and Scripting

parsing command line switches in Perl

Hi, My perl script takes few switches which i'm parsing through GetOpt::Long module. My script looks like something : myscript.pl --file="foo" --or --file="bar" The --file switch takes 2 arguments foo and bar. The 2 values of file are separated by --or switch. I want to ensure that... (1 Reply)
Discussion started by: obelix
1 Replies

4. Shell Programming and Scripting

Help parsing command line arguments in bash

Looking for a little help parsing some command line arguments in a bash script I am working on, this is probably fairly basic to most, but I do not have much experience with it. At the command line, when the script is run, I need to make sure the argument passed is a file, it exists in the... (3 Replies)
Discussion started by: Breakology
3 Replies

5. Shell Programming and Scripting

Parsing a command line parameter in script

I have a simple script that builds a complex program call which passes a number of parameters to the program. I'm trying to enhance the script to include the value of the command line parameter in the name of a file being created. The problem I'm having is that the parameter may include a forward... (11 Replies)
Discussion started by: pbmax626
11 Replies

6. Programming

Parsing command line arguments in Python

Hi, I've a python script called aaa.py and passing an command line option " -a" to the script like, ./aaa.py -a & Inside the script if the -a option is given I do some operation if not something else. code looks like ./aaa.py -a . . if options.a ---some operation--- if not options.a... (1 Reply)
Discussion started by: testin
1 Replies

7. Shell Programming and Scripting

XML: parsing of the Google contacts XML file

I am trying to parse the XML Google contact file using tools like xmllint and I even dived into the XSL Style Sheets using xsltproc but I get nowhere. I can not supply any sample file as it contains private data but you can download your own contacts using this script: #!/bin/sh # imports... (9 Replies)
Discussion started by: ripat
9 Replies

8. Shell Programming and Scripting

Multiple command execution inside awk command during xml parsing

below is the output xml string from some other command and i will be parsing it using awk cat /tmp/alerts.xml <Alert id="10102" name="APP-DS-ds_ha-140018-componentFailure-S" alertDefinitionId="13982" resourceId="11427" ctime="1359453507621" fixed="false" reason="If Event/Log Level(ANY) and... (2 Replies)
Discussion started by: vivek d r
2 Replies

9. Shell Programming and Scripting

Suggestions for command line parsing

Hi all I need to put a command line parser together to parse numeric fields and ranges passed to a script. I'm looking for a bash function that is as elegant and simple as possible. So the input would be of the following form - 1,2,8-12 This would return - 1,2,8,9,10,11,12 Input can... (7 Replies)
Discussion started by: steadyonabix
7 Replies

10. Shell Programming and Scripting

Command Line Perl for parsing fasta file

I would like to take a fasta file formated like >0001 agttcgaggtcagaatt >0002 agttcgag >0003 ggtaacctga and use command line perl to move the all sample gt 8 in length to a new file. the result would be >0001 agttcgaggtcagaatt >0003 ggtaacctga cat ${sample}.fasta | perl -lane... (2 Replies)
Discussion started by: jdilts
2 Replies
IVMAN(8)						      System Manager's Manual							  IVMAN(8)

NAME
ivman - volume manager SYNOPSIS
ivman [ -sd ] [ --nofork ] [ -c <directory> ] DESCRIPTION
Ivman, or Ikke's Volume Manager, is a daemon to handle the mounting of media as they are inserted/attached to the system. It can also be used to execute arbitrary commands when a device with certain properties is added to the system (Windows autoplay style functionality), and to execute arbitrary commands when device properties change. Ivman uses HAL to monitor the state of your system's hardware. OPTIONS
-s or --system Start Ivman in system-wide mode. This is the default if running Ivman as root. When this option is specified, Ivman reads from the system-wide configuration directory ( usually /etc/ivman/ ); if this option is not specified, Ivman reads from ${HOME}/.ivman/ instead. Either of these locations may be overridden with the -c option. Other behaviour may differ slightly when running in sys- tem-wide mode. Don't use this option unless you know you need it. --nofork Force Ivman not to daemonize, regardless of settings in IvmConfigBase.xml. Useful for capturing debugging output. -d or --debug Force Ivman to give debugging output, regardless of settings in IvmConfigBase.xml. -c <directory> or --confdir <directory> Force Ivman to load configuration files from the specified directory. DETAILS
Ivman is a flexible device manager, allowing users to run arbitrary commands when devices are added/removed, when device properties change, and when devices emit conditions. For automount purposes, Ivman should be run once from a system-wide init script and once per user session (e.g., create a link to /usr/bin/ivman in ~/.kde/Autostart or put an entry for /usr/bin/ivman in gnome-session-manager). When a device is attached, Ivman will call pmount or mount to mount the device. If pmount is used, it will mount the device readable and writeable only for the current user; if no per-user instance of Ivman is running, the device will be mounted read/write for everyone in the same group as is required to use the pmount command, and read-only for everyone else. If regular mount is used, then an fstab entry must exist in /etc/fstab for the device to be mounted, and the settings given in that fstab entry will be used for the mount. Ivman is supplied with sensible default configuration files for volume management, but autoplay functionality has no default actions; you will need to edit ${HOME}/.ivman/IvmConfigActions.xml(5) or /etc/ivman/IvmConfigActions.xml(5) to specify some programs to execute. The syntax of this file and the other Ivman configuration files are specified in their own manpages. FILES
/etc/ivman/IvmConfigActions.xml actions to perform when media is inserted /etc/ivman/IvmConfigBase.xml options affecting the running of Ivman /etc/ivman/IvmConfigConditions.xml actions to perform when devices emit conditions /etc/ivman/IvmConfigProperties.xml actions to perform when device properties change SEE ALSO
IvmConfigActions.xml(5), IvmConfigBase.xml(5), IvmConfigConditions.xml(5), IvmConfigProperties.xml(5) BUGS
Hopefully, none :-) But there could be some still lurking. If you encounter a bug, please forward details to rohan.pm@gmail.com or add it to the bug tracker at the project's Sourceforge page, http://sourceforge.net/projects/ivman 9 December 2005 IVMAN(8)
All times are GMT -4. The time now is 08:42 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy