Hello guys, this is my first post here.
Before I reformated my Time Machine Backups drive, I copied several thousands of files to another drive.
After using "Tidy Up!" I constantly had errors telling me I didn't have enough privileges to erase duplicate files. I tried everything I could.
Using chmod -R 775, and chflags -R nouchg made the trick for the first 15,000 files. I even rebooted in single user mode to apply this fix.
I decided to export the path of the missing 5,000 files using Tidy Up!, and after replacing strings with regular expressions in textmate I got something like this:
I thought it'd be as simple as appending this several thousand files into the terminal after rm -f
Of course, an "Argument list too long" dumped.
I thought I could write a shell function like this one adapted to my case:
Then I changed my file to this: (using \n)
But I have no idea how to use this. I have no idea how to use the function in the terminal window. I think I'm missing the grep or something. Then tried the same article's find approach, but I just don't know how to use it either.
What am I missing? The grep, the pipe, the part where the text file is read, escaping the ""... I'm completely lost... Please help me!
Gratefully Yours, Víctor
PS: Excuse me for my complicated way of expressing myself, English is not my mother tongue .
I realize this has already been solved, but for future reference: another solutions would have been the basic POSIX tool xargs, shipped with any unix-like os.
It's syntax is very close to the -exec switch used in find (another great tool, more of that later). In this case after removing the quotes from the lines in the file, a single command would have sufficed:
xargs is designed to overcome the Argument list too long error, and in the process has developed a nice set of features.
If you hadn't had a file containing the filenames, you could easily have generated one using find, assuming /Backup/Time Machine/dir_11735865/ is the directory containing the files you wanted to delete:
The directories would have been left alone, but cleaning them would have been a simple task.
Also Beware of executing rm in a aforementioned way without checking what's going to happen. For example, I usually change the command to echo:
hi all,
trying this using shell/bash with sed/awk/grep
I have two files, one containing one column, the other containing multiple columns (comma delimited).
file1.txt
abc12345
def12345
ghi54321
...
file2.txt
abc1,text1,texta
abc,text2,textb
def123,text3,textc
gh,text4,textd... (6 Replies)
I'd like to take the output of `pwsafe --exportdb > database.txt` and convert it to a KeePassX XML friendly format (feature request in pwsafe).
I found flat file converter but the syntax is beyond me with this example. Solutions are welcomed.
More details
Here is the pwsafe --> KeePassX XML... (2 Replies)
Hello ppl
I have a requirement to split (cut in unix) a file (A.txt) which is a pipe delimited file into A1.txt and A2.txt
Now I have to join (paste in unix) this A2.txt with external file A3.txt to form
output file A4.txt which should be CSV (comma separated file) so that third party can... (25 Replies)
I have a file containing multiple values, some of them are pipe separated which are to be read as separate values and some of them are single value all are these need to store in variables.
I need to read this file which is an input to my script
Config.txt
file name, first path, second... (7 Replies)
Hi,
I need help to split a long text in a column which is separated by ; and i need to print them out in multiple columns. My input file is tab-delimited and has 11 columns as below:-
aRg02004 21452 asdfwf 21452 21452 4.6e-29 5e-29 -1 3 50 ffg|GGD|9009 14101.10 High class -node. ; ffg|GGD|969... (3 Replies)
Hi,
I have a large number of files which are written as csv (comma-separated values).
Does anyone know of simple sed/awk command do achieve this?
Thanks!
---------- Post updated at 10:59 AM ---------- Previous update was at 10:54 AM ----------
Guess I asked this too soon. Found the... (0 Replies)
Hello,
I have some data in a text file where fields are separated by blank lines. There are only 6 fields however some fields have several lines of data as I will explain. Also data in a particular field is not consistently the same size but does end on a blank line. The first field start with... (6 Replies)
I have a log file that contains several reports with following format.
<Start of delimiter> Report1 header
Report1 header continue
Report1 header continue
Record1 header
Record1 header continue
Record1 header continue
field1 field2 field3 field4
------... (1 Reply)
Hi Guys,
I have text file which is tab/space separated but I want it to re-format into a comma separated and trim the spaces in between. Can someone spare me a perl or sed script that can do the job?
INPUT FILE:
500010245623 500 21-APR-11 05.58.21 PM ... (14 Replies)
Hi,
I have a small requirement where i need to sum up a column in a text file.
Input file
66ab 000000 534385 -00000106350.00
66cd 000000 534485 -00013364511.00
66ad 000000 534485 -00000426548.00
672a 000000 534485 000000650339.82... (5 Replies)