03-09-2010
Quote:
Originally Posted by
jaysunn
I have modified the script to work with my variables. However I am getting a xargs error.
I am on RHEL4 with bash. I checked the man page and did not see the -d option.
The -d option is used to set the delimiter between fields. If your xargs does not have this option, you can omit it; it will work fine except for filenames with spaces
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi ppl.
I have to check for duplicate files in a directory .
the directory has following files
/the/folder /containing/the/file
a1.yyyymmddhhmmss
a1.yyyyMMddhhmmss
b1.yyyymmddhhmmss
b2.yyyymmddhhmmss
c.yyyymmddhhmmss
d.yyyymmddhhmmss
d.yyyymmddhhmmss
where the date time stamp can be... (1 Reply)
Discussion started by: asinha63
1 Replies
2. Shell Programming and Scripting
Hi,
is it possible to remove all duplicate lines from all txt files in a specific folder?
This is too hard for me maybe someone could help.
lets say we have an amount of textfiles 1 or 2 or 3 or... maximum 50
each textfile has lines with text.
I want all lines of all textfiles... (8 Replies)
Discussion started by: lowmaster
8 Replies
3. Shell Programming and Scripting
Hi
I have been struggling with a script for removing duplicate messages from a shared mailbox.
I would like to search for duplicate messages based on the “Message-ID” string within the messages files.
I have managed to find the duplicate “Message-ID” strings and (if I would like) delete... (1 Reply)
Discussion started by: spangberg
1 Replies
4. Shell Programming and Scripting
Hi all.
Am doing continuous backup of mailboxes using rsync.
So whenever a new mail arrives it is automatically copied on backup server.
When a new mail arrives it is named as xyz:2, when it is read by the email client an S is appended xyz:2,S
Eventually , 2 copies of the same file exist on... (7 Replies)
Discussion started by: coolatt
7 Replies
5. Shell Programming and Scripting
Dear All,
I have multiple files having number of records, consist of more than 10 columns some column values are duplicate and i want to remove these duplicate values from these files.
Duplicate values may come in different files.... all files laying in single directory..
Need help to... (3 Replies)
Discussion started by: arvindng
3 Replies
6. Shell Programming and Scripting
dear all,
i'm preparing a script which can do these actions :
1. stop remove server's certain service
2. clean the files on remote servers simultaneously (because lots of files need to be deleted)
3. after files/logs are removed, restart the service again
i'm stuck on how to clean remote... (4 Replies)
Discussion started by: tiger2000
4 Replies
7. Shell Programming and Scripting
Hi,
In a directory, e.g. ~/corpus is a lot of files and subdirectories. Some of the files are named:
12345___PP___0902___AA.txt
12346___PP___0902___AA. txt
12347___PP___0902___AA. txt
The amount of files varies. I need to keep the highest (12347___PP___0902___AA. txt) and remove... (5 Replies)
Discussion started by: corfuitl
5 Replies
8. UNIX for Dummies Questions & Answers
Hi All,
Please help me for a shell. I am a New to unix
I am trying to DB dump file from one server and copying it to another server.
From My Local ServerA connecting to remote ServerB using ssh and taking dump of a instance. That Dump file i need to copy to ServerC.
I am able to connect... (6 Replies)
Discussion started by: maddyd2k
6 Replies
9. Windows & DOS: Issues & Discussions
So, I have text files,
one "fail.txt"
And one
"color.txt"
I now want to use a command line (DOS) to remove ANY line that is PRESENT IN BOTH from each text file.
Afterwards there shall be no duplicate lines. (1 Reply)
Discussion started by: pasc
1 Replies
10. Shell Programming and Scripting
TARGET_DIR='/media/andy/MAXTOR_SDB1/Ubuntu_Mate_18.04/'
REGEX='{4}-{2}-{2}_{2}:{2}' # regular expression that match to: date '+%Y-%m-%d_%H:%M'
LATEST_FILE="$(ls "$TARGET_DIR" | egrep "^${REGEX}$" | tail -1)"
find "$TARGET_DIR" ! -name "$LATEST_FILE" -type f -regextype egrep -regex... (7 Replies)
Discussion started by: drew77
7 Replies
rl(1) User Commands rl(1)
NAME
rl - Randomize Lines.
SYNOPSIS
rl [OPTION]... [FILE]...
DESCRIPTION
rl reads lines from a input file or stdin, randomizes the lines and outputs a specified number of lines. It does this with only a single
pass over the input while trying to use as little memory as possible.
-c, --count=N
Select the number of lines to be returned in the output. If this argument is omitted all the lines in the file will be returned in
random order. If the input contains less lines than specified and the --reselect option below is not specified a warning is printed
and all lines are returned in random order.
-r, --reselect
When using this option a single line may be selected multiple times. The default behaviour is that any input line will only be
selected once. This option makes it possible to specify a --count option with more lines than the file actually holds.
-o, --output=FILE
Send randomized lines to FILE instead of stdout.
-d, --delimiter=DELIM
Use specified character as a "line" delimiter instead of the newline character.
-0, --null
Input lines are terminated by a null character. This option is useful to process the output of the GNU find -print0 option.
-n, --line-number
Output lines are numbered with the line number from the input file.
-q, --quiet, --silent
Be quiet about any errors or warnings.
-h, --help
Show short summary of options.
-v, --version
Show version of program.
EXAMPLES
Some simple demonstrations of how rl can help you do everyday tasks.
Play a random sound after 4 minutes (perfect for toast):
sleep 240 ; play `find /sounds -name '*.au' -print | rl --count=1`
Play the 15 most recent .mp3 files in random order.
ls -c *.mp3 | head -n 15 | rl | xargs --delimiter='
' play
Roll a dice:
seq 6 | rl --count 2
Roll a dice 1000 times and see which number comes up more often:
seq 6 | rl --reselect --count 1000 | sort | uniq -c | sort -n
Shuffle the words of a sentence:
echo -n "The rain in Spain stays mainly in the plain."
| rl --delimiter=' ';echo
Find all movies and play them in random order.
find . -name '*.avi' -print0 | rl -0 | xargs -n 1 -0 mplayer
Because -0 is used filenames with spaces (even newlines and other unusual characters) in them work.
BUGS
The program currently does not have very smart memory management. If you feed it huge files and expect it to fully randomize all lines it
will completely read the file in memory. If you specify the --count option it will only use the memory required for storing the specified
number of lines. Improvements on this area are on the TODO list.
The program uses the rand() system random function. This function returns a number between 0 and RAND_MAX, which may not be very large on
some systems. This will result in non-random results for files containing more lines than RAND_MAX.
Note that if you specify multiple input files they are randomized per file. This is a different result from when you cat all the files and
pipe the result into rl.
COPYRIGHT
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Arthur de Jong.
This is free software; see the license for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Version 0.2.7 Jul 2008 rl(1)