Removing a filename which has special characters passed from a pipe with xargs
Hi,
On AIX 5200-07-00 I have a find command as following to delete files from a certain location that are more than 7 days old. I am being told that I cannot use -exec option to delete files from these directories.
Having said that I am more curious to know how this can be done.
an sample file name could be something as follows
When I use the following command
I get the message that states that an end quote is missing as follows
I am assuming it is because of the single quote in the file name.
When I try the following command in the directory where the file is located.
I get the same results
How do I resolve this issue and make the above find command work?
Please advise.
Thx
Jerardfjay
Last edited by jerardfjay; 05-19-2009 at 08:19 AM..
Reason: More information
On AIX 5200-07-00 I have a find command as following to delete files from a certain location that are more than 7 days old. I am being told that I cannot use -exec option to delete files from these directories.
...
That's a big limitation. Additionally if GNU find/xargs was installed, their -0 option could have been used to handle the bad filenames... Maybe this will help:
[ Tested on Solaris with non-GNU tools. Does not handle filenames with embedded newlines. ]
I have developed a small script to remove the Control M characters that get embedded when we move any file from Windows to Unix. For some reason, its not working in all scenarios. Some times I still see the ^M not being removed. Is there anything missing in the script:
cd ${inputDir}... (7 Replies)
hi, I have quite a bunch of files with annoyingly long filenames. I wanted to cut the range of characters from 9-18 and just retain the first 8 characters and the .extension. any suggestion how to do it. thanks much.
original filename: 20000105_20000105_20100503.nc.asc
output filename:... (4 Replies)
Hi,
It's my first time here... anyways, I have a simple problem with these filenames. This is probably too easy for you guys:
ABC_20101.2A.2010_01
ABD_20103.2E.2010_04
ABE_20107.2R.2010_08
Expected Output:
ABC_20101
ABD_20103
ABE_20107
The only pattern available are the ff:
1) All... (9 Replies)
Dear Friends,
I want to remove text between two patters.
Problem is, it has random special characters like \ / | * ` ~ ! $ etc.
These random special characters has no fixed length. But these special characters are appearing between a fixed pattern
e.g.
DM&^%#|#!\/?CT
Expected output... (14 Replies)
I'm very new to awk and sed and I've been struggling with this for a while.
I'm trying to search a file for a string with special characters and this string is a command line argument to a simple script.
./myscript "searchpattern" file
#!/bin/sh
awk "/$1/" $2 > dupelistfilter.txt
sed... (6 Replies)
Hi all,
Am piping a list of files to "xargs rm -v".
The files may have spaces in their names.
Please advise how do i deal with it... :confused:
Thanks. (3 Replies)
How to remove special chracters @ END OF EACH LINE in a file
file1.txt:
0003073413^M
0003073351^M
0003073379^M
0003282724^M
0003323334^M
0003217159^M
0003102760^M
0002228911^M
I used the below command but it is not working ?
perl -pi -e 's/^M\/g' file1.txt (6 Replies)
hi:
i have several thousand files from users and of course they use all kind of characters on filenames. I have things like:
My special report (1999 ) Lisa & Jack's work.doc
crazy.
How do I remove all this characters in the current dir and subdirs too?
Thanks. (3 Replies)
Hi All,
I am facing a weird problem. I have got a directory structure copied from windows to Linux. Some of the folders are named like
/gfs/data/Dow Jones $5/ DJ FCBOT_O_tick_1998.zip
/gfs/data/Dow Jones $5/ DJ FCBOT_O_tick_2000.CSV
/gfs/data/Dow Jones... (6 Replies)
I have file special.txt with the following data.
<header info>
123$ty5%98&0asd
1@356fgbv78
09*&^5jkns43(
...........some more rows.
In my output file, I want to eliminate all the special characters in my file and I want all other data. need some help. (6 Replies)