I have a PHP code that generates the file name on which wget will append its logs. I generated 2000+ files, but the problem is I am having trouble working with them because I had a mistake of putting PHP_EOL
as part of its name, that code will add
LF/line feed/%0A
at its name
Example of such file name (when accessed via browser, when put on /var/www/html) http://xxxx/wget_01_a%0a.txt
notice the %0a
before the extension name
I messed up, and I wish there's a rename batch that will search through all files and if it found line feed
it would rename it without the line feed so it would just be http://xxxx/wget_01_a.txt
I am not pretty sure how to handle this because seems like when I ls
on putty all special character not limited to that unwanted char becomes ?
, what I only wish to target is that line feed.
\n
? Can you do something like echo*.txt | od -c
so we see what actual non-printable character is there? – dhag Mar 12 '15 at 18:40\n
http://pastebin.com/wXCDCJjr – arvil Mar 12 '15 at 18:45*.txt
(which would explain whyrename
doesn't pick it up). If you set the two patterns to, say,txt
instead of$'\n'
and''
, do you get any output? Does echo $'\n' indeed print two newlines? – dhag Mar 12 '15 at 18:55-v
to parameter seemed to solved my problem? if you update your answer I can mark your answer correct thanks! – arvil Mar 12 '15 at 19:02rename
does not support options and understood your query to mean "replace-v
with newline". It's great if it means your problem is solved. Out of curiosity, what doesrename --help
say about-v
, if anything? – dhag Mar 12 '15 at 19:06rename
only supportscall: rename from to files...
. I will edit my answer to reflect this. – dhag Mar 12 '15 at 19:11rename $'\r' '' wget_*
for it to work – rshdev Aug 25 '16 at 15:43