Sponsored Content
Full Discussion: Expansion within cp
Top Forums UNIX for Dummies Questions & Answers Expansion within cp Post 302748997 by jim mcnamara on Thursday 27th of December 2012 09:23:21 AM
Old 12-27-2012
Based on your pattern attempt, I assume bash if you are excluding one filename

Code:
# set extglob on -- shopt will show it's status
shopt -s extglob
cp !(def_cust).dat /somewhere

The not (!) operator means do not match. You can have multiple pipe-delimited patterns
See the section on 3.5.8.1 Pattern Matching here:
Bash Reference Manual

You may want to go with another pattern/way.
 

10 More Discussions You Might Find Interesting

1. AIX

AIX Expansion CD

Hey Anyone have a copy of the Expansion CD for the old 5.1 Version of AIX Thanks (0 Replies)
Discussion started by: almuwatta
0 Replies

2. Shell Programming and Scripting

~ expansion in printf

Hi, I have a script that at one point prints to a file as follows: printf -- $2 > ~/.mydir/$1 The idea is to print to a hidden directory .mydir in my home directory. I've already sanitized the inputs and $1 is in the format path1/path2/filename and $2 is some user input. When I run this... (2 Replies)
Discussion started by: Rledley
2 Replies

3. UNIX for Dummies Questions & Answers

sudo and expansion

Hi there, Can anyone explain me the following behavior? hfserver:~# ls -l /home/cronlogs/mysqldump* -rw-r--r-- 1 root root 10658464 2009-01-18 03:00 /home/cronlogs/mysqldump_20090118030002 -rw-r--r-- 1 root root 10651035 2009-01-19 03:00 /home/cronlogs/mysqldump_20090119030001 -rw-r--r-- 1... (4 Replies)
Discussion started by: chebarbudo
4 Replies

4. Shell Programming and Scripting

Need to print the expansion of the found string (the expansion is beween two delimiters '-' , '||'

Hi , could anyone help me out with this problem. sample.txt has this content : u001- this is used for project1 || u002- this is used for p2|| not to be printed u003- this is used for project3 || u004- this is used for p4 || u005- this is used for project5 || u006- this is used for p6... (9 Replies)
Discussion started by: Balaji PK
9 Replies

5. Shell Programming and Scripting

Need help with parameter expansion

Say you have this numeric variable that can be set by the user but you never want it to leave a certain range when it gets printed. How could you use parameter expansion such that it will never expand outside of that boundary? Thanks ---------- Post updated at 11:09 PM ---------- Previous update... (3 Replies)
Discussion started by: stevenswj
3 Replies

6. Shell Programming and Scripting

Expansion does not work

Hi, I'm trying to figure out whether some files exist. Locations of those file are stored in a plain text file called temp.txt in this way: All environment variables ($LIB_HOME and $ORACLE_HOME) have been set using export command. Then I do: while read line; do ] && echo "OK ==> $line" ||... (6 Replies)
Discussion started by: AlbertGM
6 Replies

7. Shell Programming and Scripting

Understanding awk 'expansion'

Heyas Recently i wanted to help someone with an awk script, but the end-script didnt work as expected. He wanted, if HOME was empty, to get the HOME of the current USER from /etc/passwd. At first i tried hardcoded with root: awk -F: '/^root/ {print $6}' /etc/passwd As that worked, i've... (4 Replies)
Discussion started by: sea
4 Replies

8. Shell Programming and Scripting

Bash expansion

Hello. I cannot write a command without using eval. Any help is welcome Note 1 : What does the function SOMETHING has no importance. Note 2 : What does the command find has no importance. It is an expansion variable problem : where to put or or or anythings else What works (FILTRE_1... (8 Replies)
Discussion started by: jcdole
8 Replies

9. Shell Programming and Scripting

Tilde expansion

(Using Bash 4.4) When I write something like dir="~/dox" ls $dir then I get the message that the directory '~/docs' does not exist. I understand that the tilde is not expanded at the time of the above assignment because of the quotes. But why is it not expanded at the time when the ls command is... (2 Replies)
Discussion started by: Ralph
2 Replies

10. Shell Programming and Scripting

Use parameter expansion over a parameter expansion in bash.

Hello All, Could you please do help me here as I would like to perform parameter expansion in shell over a parameter expansion. Let's say I have following variable. path="/var/talend/nat/cdc" Now to get only nat I could do following. path1="${path%/*}" path1="${path1##*/}" Here... (8 Replies)
Discussion started by: RavinderSingh13
8 Replies
XML::LibXML::Pattern(3) 				User Contributed Perl Documentation				   XML::LibXML::Pattern(3)

NAME
XML::LibXML::Pattern - XML::LibXML::Pattern - interface to libxml2 XPath patterns SYNOPSIS
use XML::LibXML; my $pattern = XML::LibXML::Pattern->new('/x:html/x:body//x:div', { 'x' => 'http://www.w3.org/1999/xhtml' }); # test a match on an XML::LibXML::Node $node if ($pattern->matchesNode($node)) { ... } # or on an XML::LibXML::Reader if ($reader->matchesPattern($pattern)) { ... } # or skip reading all nodes that do not match print $reader->nodePath while $reader->nextPatternMatch($pattern); $pattern = XML::LibXML::Pattern->new( pattern, { prefix => namespace_URI, ... } ); $bool = $pattern->matchesNode($node); DESCRIPTION
This is a perl interface to libxml2's pattern matching support http://xmlsoft.org/html/libxml-pattern.html. This feature requires recent versions of libxml2. Patterns are a small subset of XPath language, which is limited to (disjunctions of) location paths involving the child and descendant axes in abbreviated form as described by the extended BNF given below: Selector ::= Path ( '|' Path )* Path ::= ('.//' | '//' | '/' )? Step ( '/' Step )* Step ::= '.' | NameTest NameTest ::= QName | '*' | NCName ':' '*' For readability, whitespace may be used in selector XPath expressions even though not explicitly allowed by the grammar: whitespace may be freely added within patterns before or after any token, where token ::= '.' | '/' | '//' | '|' | NameTest Note that no predicates or attribute tests are allowed. Patterns are particularly useful for stream parsing provided via the "XML::LibXML::Reader" interface. new() $pattern = XML::LibXML::Pattern->new( pattern, { prefix => namespace_URI, ... } ); The constructor of a pattern takes a pattern expression (as described by the BNF grammar above) and an optional HASH reference mapping prefixes to namespace URIs. The method returns a compiled pattern object. Note that if the document has a default namespace, it must still be given an prefix in order to be matched (as demanded by the XPath 1.0 specification). For example, to match an element "<a xmlns="http://foo.bar"</a>", one should use a pattern like this: $pattern = XML::LibXML::Pattern->new( 'foo:a', { foo => 'http://foo.bar' }); matchesNode($node) $bool = $pattern->matchesNode($node); Given an XML::LibXML::Node object, returns a true value if the node is matched by the compiled pattern expression. SEE ALSO
XML::LibXML::Reader for other methods involving compiled patterns. AUTHORS
Matt Sergeant, Christian Glahn, Petr Pajas VERSION
2.0110 COPYRIGHT
2001-2007, AxKit.com Ltd. 2002-2006, Christian Glahn. 2006-2009, Petr Pajas. LICENSE
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.18.2 2014-02-01 XML::LibXML::Pattern(3)
All times are GMT -4. The time now is 10:42 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy