Thanks for everyones comments on the issue I was having simply replacing a '.' with '\.'. I've now realized that wasn't the issue. The code I had was working, it was looking at in in perl debug mode that was giving me a strange result.
I receive a tarred file that has the directory path within it.
What I'm trying to do is untar the file into a different directory using pax. I thought the problem was due to the substitution not recognizing full stops within the directory name.
However I have now found that whilst the command
pax -r -f pax.tar -s'/\/home\/kev\/pax\// \/data\/kev\/atlanta\/emtex\/invoices\//p' works on the command line with the following result
$ tar -tvf pax.tar
drwxrwxr-x 252 1 0 Aug 11 14:12:55 2010 /home/kev/pax/
-rw-rw-r-- 252 1 0 Aug 11 14:12:52 2010 /home/kev/pax/t1
-rw-rw-r-- 252 1 0 Aug 11 14:12:54 2010 /home/kev/pax/t2
-rw-rw-r-- 252 1 0 Aug 11 14:12:55 2010 /home/kev/pax/t3
$ pax -r -f pax.tar -s'/\/home\/kev\/pax\// \/data\/kev\/atlanta\/emte
+x\/invoices/p'
/home/kev/pax/t1 >> /data/kev/atlanta/emtex/invoices/t1
/home/kev/pax/t2 >> /data/kev/atlanta/emtex/invoices/t2
/home/kev/pax/t3 >> /data/kev/atlanta/emtex/invoices/t3
when I try to embed the command into a perl script via
my $homedir="/home/kev";
chdir $homedir;
my $cmd = "pax -r -f pax.tar -s'/\/home\/kev\/pax\// \/data\/kev\/atla
+nta\/emtex\/invoices\//p'";
system ( $cmd );
I get the error
pax: 0511-660 A replacement string was not added : 0511-661 An invalid trailing option was specified with the -s option
So what I *should* have been asking was, what am I doing wrong when I embed this pax command into my perl script?
Thanks guys and gals
Kev
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.