07-01-2011
Command comparisons
Hi guys,
Im trying to figure out what is the difference between using a | and the command xargs ... examples of usage:
1) ls * | wc -w => this gives you the number of files in the current directory including all subdirectories
2) find . “*.log” | xargs grep ERROR => this gives you all the occurrences of ERROR in all .log files in the current directory and all subdirectories
PLUS! what is the difference of the above commands to this one below and why should I use one instead of the other:
find . “*.log” -exec grep ERROR ‘{}' \;
Any help will be very much appreciated.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi, I need a script that loops through all the files two directories
passed to it via parameter, and if two files have the same name, do a
cmp comparison on the files. If the files are different, output the
specifics returned by cmp. What's the best way to go about writing
this, as I am a... (6 Replies)
Discussion started by: herman404
6 Replies
2. UNIX for Dummies Questions & Answers
Say for example I have a list of numbers..
5
10
13
48
1
could I use grep to show only those numbers that are above 10? For various reasons I can only use grep... not awk or sed etc. (7 Replies)
Discussion started by: Uss_Defiant
7 Replies
3. Shell Programming and Scripting
I have two files.And a sort of matrix analysis.
Both files have a string followed by two numbers:
File 1:
A 2 7
B 3 11
C 5 10
......
File 2:
X 1 10
Y 3 5
Z 5 9
What I'd like to do is for each set of numbers in the second file indicate if the first or second number (or both) in... (7 Replies)
Discussion started by: dcfargo
7 Replies
4. Shell Programming and Scripting
So, I have no formal higher education in programming at all and am self taught. I am now wondering what would be considered best practices? Like should I hard code a variable, then compare it to what I want to know or achieve, or should I just put the commands with in the brackets?
Example, a... (5 Replies)
Discussion started by: tlarkin
5 Replies
5. Shell Programming and Scripting
Can someone please tell me what is wrong with this stings comparison?
#!/bin/sh
#set -xv
set -u
VAR=$(ping -c 5 -w 10 google.com | grep icmp_req=5 | awk '{print $6}')
echo I like cookies
echo $VAR
if "$VAR" == 'icmp_req=5'
then
echo You Rock
else
echo You Stink
fiThis is the error.... (6 Replies)
Discussion started by: cokedude
6 Replies
6. UNIX for Dummies Questions & Answers
Hi,
I want to perform a simple date comparisons, i.e. select all files modified after a certain date (say 12-feb-2011)
I do not have the option of creating a file and using find's -newer option.
Any simple way to do this? I can do this by reading the stat command's output and comparing... (10 Replies)
Discussion started by: jawsnnn
10 Replies
7. UNIX for Dummies Questions & Answers
I'd love to get help on this one please. Ok so say I have a file called README with lines such as this:
index:index.html
required:file1.1:file2.1:file3.1
I'm having trouble with writing an if statement that compares the items in a list with a file inside README, what I imagine in my head... (7 Replies)
Discussion started by: mistsong1
7 Replies
8. Shell Programming and Scripting
Hi,
I have 25 groups and I need to perform all possible pairwise compariosns between them using the formula n(n-1)/2. SO in my case it will be 25(25-1)/2 which is equal to 300 comparisons.
my 25 groups are
FG1 FG2 FG3 FG4 FG5
NT5E CD44 CD44 CD44 AXL
ADAM19 CCDC80 L1CAM L1CAM CD44... (1 Reply)
Discussion started by: Diya123
1 Replies
9. Shell Programming and Scripting
Hi all,
I want to compare two files based on column value
Kindly help me
a.txt
123,ABCD
456,DEF
789,SDF
b.txt
123,KJI
456,LMN
321,MJK
678,KOL
Output file should be like
Common on both files
c.txt
123,ABCD,KJI (8 Replies)
Discussion started by: aaysa123
8 Replies
10. Shell Programming and Scripting
Here is the sample code:
str1="abccccc"
str2="abc?"
if ]; then
echo "same string"
else
echo "different string"
fi
Given that ? implies 0 or 1 match of preceding character, I was expecting the output to be "different string", but I am seeing "same string".
Am I not using the... (3 Replies)
Discussion started by: Rameshck
3 Replies
LEARN ABOUT DEBIAN
bbackupd
BBACKUPD(8) Box Backup BBACKUPD(8)
NAME
bbackupd - Box Backup client daemon
SYNOPSIS
bbackupd [-DFkqvVT] [-c config-file] [-t tag]
DESCRIPTION
bbackupd runs on client computers in the background, finding new files to back up. When it is time for a backup, bbackupd will connect to
the server (bbstored) to upload the files.
A running bbackupd daemon can be controlled with the bbackupctl command, to make it shut down, reload its configuration, or start an
immediate backup.
bbackupd needs to be configured to tell it which files to back up, how often, and to which server (running bbstored). See the Client
Configuration page for more information. For this, you must write a configuration file. You must either place it in the default location,
or tell bbackupd where to find it.
You can check the default location with the -h option. The default on Unix systems is usually /etc/box/bbackupd.conf. On Windows systems,
it is bbackupd.conf in the same directory where bbackupd.exe is located. If bbackupd cannot find or read the configuration file, it will
log an error message and exit.
bbackupd usually writes log messages to the system logs, using the facility local5, which you can use to filter them to send them to a
separate file. It can also write them to the console, see options below. If bbackupd is not doing what you expect, please check the logs
first of all.
Options
-c config-file
Use the specified configuration file. If -c is omitted, the last argument is the configuration file. If none is specified, the default
is used (see above).
-D
Debugging mode. Do not fork into the background (do not run as a daemon). Not available on Windows.
-F
No-fork mode. Same as -D for bbackupd. Not available on Windows.
-k
Keep console open after fork, keep writing log messages to it. Not available on Windows.
-q
Run more quietly. Reduce verbosity level by one. Available levels are NOTHING, FATAL, ERROR, WARNING, NOTICE, INFO, TRACE, EVERYTHING.
Default level is NOTICE in non-debugging builds. Use once to drop to WARNING level, twice for ERROR level, four times for no logging at
all.
-v
Run more verbosely. Increase verbosity level by one. Use once to raise to INFO level, twice for TRACE level, three times for EVERYTHING
(currently the same as TRACE).
-V
Run at maximum verbosity (EVERYTHING level).
-t tag
Tag each console message with specified marker. Mainly useful in testing when running multiple daemons on the same console.
-T
Timestamp each line of console output.
FILES
/etc/box/bbackupd.conf
SEE ALSO
bbackupd.conf(5), bbackupd-config(8), bbackupctl(8)
AUTHORS
Ben Summers
Per Thomsen
James O'Gorman
Box Backup 0.11 10/28/2011 BBACKUPD(8)