Thank you for your help, Luke, in clarifying my one-liner. I'm not the best perl hacker and welcome the chance to learn from other who are.
I used the egrep to get only the files with cgi....mail2friend or centernet...mail2friend in them. I thought I had earlier tried something like you suggested, leaving out the egrep and put the search in the perl, and perl generated a file ending in ~ for each file it read, whether or not it had made the substitution. I didn't want it to duplicate all my HTML pages. I could be not remembering this correctly, however. If I understand your suggestion on quotes in one-liners, I should have written: perl -pi~ -e's?http://.*\.jhuccp\.org(/cgi-bin/mail2friend)?\1?g;' I don't have any quotes inside my expression. Are you making this suggestion for my future cases, or have I not understood you correctly? On the use of the backreference, are you saying I could have written: perl -pi~ -e"s?http://.*\.jhuccp\.org(/cgi-bin/mail2friend)?/cgi-bin/mail2friend?g;" I agree, but that's SO much typing. :) Thanks, again for your suggestions. -Kevin Zembower >>> Luke Bakken <[EMAIL PROTECTED]> 11/28/01 12:05PM >>> Just to clarify the command: find -iname "*.*htm*" -o -iname "*.stm" | \ xargs egrep -l \ "centernet\.jhuccp\.org/cgi-bin/mail2friend|cgi\.jhuccp\.org/cgi-bin/mail2friend" | \ xargs perl -pi~ -e"s?http://.*\.jhuccp\.org(/cgi-bin/mail2friend)?\1?g;" --------------------- first off, why are you including the egrep statement? if it is to weed out files only containing the line: centernet.jhuccp.org/cgi-bin/mail2friend or cgi.jhuccp.org/cgi-bin/mail2friend why not do this in your perl script, and leave out the egrep (split across two lines for readibility): perl -pi~ -e's?http://(?:centernet|cgi)\.jhuccp\.org /cgi-bin/mail2friend?/cgi-bin/mail2friend?g;' Also for perl one-liners, it's usually best to enclose them in single quotes, and then use q() or qq() inside the one-liner for single and double quotes, respectively. Also, the backreference is unnecessary as your captured string is just a literal string. Let me know if this helps your problem. Luke > It seems to run fine and changes many files, but when I go searching > for the string that was supposed to be changed, I keep finding more > file. Many were changed correctly, but some were not. > > It strikes me that maybe perl can't take too many arguments at once. > There are options to the xarg command that allow no more than so many > arguments at a time to be passed. Is this what's wrong? What should I > set the number of arguments to? > > Thanks for trying to help me with this. > > -Kevin Zembower > > ----- > E. Kevin Zembower > Unix Administrator > Johns Hopkins University/Center for Communications Programs > 111 Market Place, Suite 310 > Baltimore, MD 21202 > 410-659-6139 > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]