General :: Use '{}' To Redirect Output Of A Command Run Through Find's -exec Option?

Jan 10, 2011

I am trying to automate an svnadmin dump command for a backup script, and I want to do something like this:

find /var/svn/* ( ! -name dir -prune ) -type d -exec svnadmin dump {} > {}.svn ;

This seems to work, in that it looks through each svn repository in /var/svn, and runs svnadmin dump on it.

However, the second {} in the exec command doesn't get substituted for the name of the directory being processed. It basically just results a single file named {}.svn.

I suspect that this is because the shell interprets > to end the find command, and it tries redirecting stdout from that command to the file named {}.svn.

View 2 Replies


ADVERTISEMENT

Programming :: Bash Ambiguous Redirect - Redirect One Command Output Which Will Be Treat As A Content Of File For Another Command?

Mar 9, 2011

I am trying to grep multiple numbers from file, grep does have the -f option for that.

Code: grep -f <`seq 500 520` /etc/passwd I know this could be done with

Code: for i in `seq 500 520`; do grep "$i" /etc/passwd; done But my question is fare more behind this example. It is possible to redirect one command output which will be treat as a content of file for another command ?

View 2 Replies View Related

General :: Exec Command With Grep Output?

Feb 15, 2011

I have a requirement to find the files having its name as ack_reply. However, there are many other files in the same directory as these resides. Now I have to remove these files from the folder and retain others after 7 days. So I tried to write the below script with grep command.

find $directory -type f -mtime +7 | grep ack_reply

how can I pass this output to -exec command.

If I am not using grep command my script would be as

find $directory -type f -mtime +7 -exec remove.sh {}\;;

How can I use -exec with grep and find.

View 4 Replies View Related

General :: Redirect Output From Dd Command?

Apr 7, 2010

How to redirect output from dd command to /dev/null ?

View 2 Replies View Related

General :: Redirection - Redirect The Output Of A Program To The Diff Command?

Jan 13, 2011

I have a program that writes to stdout. Is there a way that I can redirect the output to the linux diff command or do I have to write the output to a file and then compare that. For example I have a bunch of test input files for a program and the corresponding expected output in another set of files. And I'd like to do something like ./program < t1.input | diff t1.expected.

View 3 Replies View Related

General :: Redirect Output Of A Command To Another File Inside Shell Script?

Aug 26, 2010

I am writing a script in which I am using AWK to append to a line in a file and save the file. The command I am using is:

Code:
awk '{s=$0; if ( NR==4 ){s=s ":/usr/java/jdk1.6.0_19/bin" } print s;}' $appName > $appName.new

[code]...

View 4 Replies View Related

General :: Run A Command Per File From The Output Of "find" Command?

Sep 8, 2010

I want to scan a particular directory recursively and run a particular command with each file as input. For this I am using "find /dir/path". I dont want to write any long script containing loop on the output of "find". I want a single command which will allow me to run a command on each file of the "find" command output.

View 3 Replies View Related

General :: Ssh Exec Command And Exit Session

Jan 13, 2011

is it possible to execute command and terminate session all in one phrase

something like this connect to server hostname and than execute command "ls" and than some command

ssh username"at"hostname ls "something"

without "something" this phrase connects to server and lists directory, I need something that after listing directory, terminates session.

View 1 Replies View Related

General :: How To Redirect The Output To Different Column In .csv File?

Apr 25, 2011

I was trying to redirect the output of two variables to different columns of a .csv file in MS excel like this,

Code:
echo "$a $b" > abc.csv
But I am getting both $a and $b in the same column, is there anything I can use instead of to move the value of $b to the next column? Or is there a good different approach to do it?

View 2 Replies View Related

General :: Redirect Output From Remote To Local?

Mar 29, 2011

I'm doing some commands on a remote server (using ssh to log on to the remote server, did a ssh key swap), how do i redirect the output of a command back to the local server ?the person who helps me out is my HERO i'm really stuck on this and it would bring me a lot further if i get this to work

View 14 Replies View Related

General :: Sudo Aureport Redirect Output?

Aug 6, 2010

How do run aureport as root and redirect it's output to a directory that's only writeable by root?

Ex: sudo -u root aureport > /var/log/test.report
/var/log/test.report permission denied
/var/log has these permissions:
drwxr-xr-x root root

View 1 Replies View Related

General :: Redirect Standart Output To Current Terminal?

Apr 17, 2010

i have a process launch by another app, i want to see the output (that is in console) in a terminal (gnome-terminal or tty); how can i capture de standart I/O from a process. my process (aria2) is launch by firefox and the output of ps is like:

# ps aux | grep aria2
dorian 30289 2.8 0.1 12148 4048 ? D 07:08 0:03 aria2c --continue -d /home/downloads/so/suse --referer=http://software.opensuse.org/112/en

...is running but i cant see the output (download state), how can i capture or redirect standart I/O to my terminal to get something like the output of:

$ aria2c --continue -d /home/downloads/so/suse --referer=http://software.opensuse.org/112/en --load-cookies=/tmp/flashgot.h2fnxf84.default/cookies --input-file=/tmp/flashgot.h2fnxf84.default/flashgot.fgt
[#1 SIZE:6.7MiB/4,289.3MiB(0%) CN:5 SPD:25.3KiBs ETA:48h01m01s]

View 1 Replies View Related

General :: Run A Script In The Background Redirect The Output To A File?

Feb 11, 2010

I wrote a short script that sleeps for 30 seconds then outputs "Done" to the screen:

sleep 30
echo Done

now I want to re-direct the output to a file, I tried:

./scriptName& > fileName

Didn't work, "Done" still came out to the screen.

View 5 Replies View Related

General :: Unable To Redirect Script Output To File

Aug 25, 2009

I have a python script that when run outputs to screen.

eg.
./international_sms_check.py 0403000511 919227434827
TS 21 check ok
TS 22 check ok
sms successfully delivered from 61403000511 to 919227434827
But when I try:./international_sms_check.py 0403000511 919227434827 > test

The file test is created but there is nothing in it.if I try ls > test this works fine with output of ls redirected to file test.

View 4 Replies View Related

General :: File Output Redirection - Redirect Stream To Multiple Files?

Dec 7, 2010

I'm working on some scheduled task script files to keep nightly backups of some of our database information in place, and it's a bit annoying when they blow up. I know how to redirect stdout and stderr to a flat file I can view when I come in, and I know that 2>&1 maps them both to the same file (whatever was named in 1). However, I'm running into some cron-time situations where it's easier to have the two streams together, and other cron-time situations where it's easier to have them separated. I can't really tell which is going to happen; is there some way I could create both kinds of output file for my scripts, so that I've got a std_err only file and an interleaved std_out/std_err file?

Note: I've looked at the 'tee' command, but I don't think it will work for what I'm after. 'tee' appears to only work with stdout; I'm trying to work with stderr.

View 5 Replies View Related

Software :: Use The Output Of The Find Command In The Bash Script?

Nov 17, 2010

I'm fairly new to writing bash scripts and haven't been able to find a an example of effectively using a the find command in a bash script.

I want to run some git commands on any sub directory that has a .git project in it. Getting to the directory is not my problem, its how to find them

What i want to do is execute

Code:
find -name .git

Then act on each response line that is printed out. E.G Navigate to the directory and run git status.

How do i use the output of the find command in the bash script?

View 6 Replies View Related

Programming :: Direct Standard Output From Find Command?

Mar 26, 2010

I'm trying to pull out sections from a bunch of files. For one file, I use:

Code:
sed '/string1/,/string2/ !d' <filename.ext >newfilename.ext
to pull out everything between two strings in the original file and put them in a new file.

[code]....

View 3 Replies View Related

General :: Ran "find / -mtime +1 -exec Rm {} ;" - Trying To Clear A Directory ?

Jul 6, 2011

I'm very very tired, worked all night long, and I did't sleep for hours... So I'm like a zombie now... half awake, and half asleep.

I was trying to clear a directory. Then I run the command cd to enter the directory, and then before thinking I run this dangerous command. on my Linux server: "find / -mtime +1 -exec rm {} ;"

I got a lot of:

Could this command have deleted something inside these directories? I'm afraid that the next reboot the server won't startup...

View 2 Replies View Related

Ubuntu Multimedia :: When Click On Perference Then Sounds And Go To The Output Selection It Has Only Dummy Output As A Option?

Apr 29, 2010

I cant seem to get the sound working and when I click on perference then sounds and go to the output selection it has only dummy output as a option.

View 3 Replies View Related

Ubuntu :: Using Find And Exec - Convert To Ogg?

Mar 12, 2011

I have a bunch of .caf files in a directory that I want to convert to ogg but I cannot figure out way to do it (except manually). I want to do: sox filename.caf filename.ogg

[Code]...

View 2 Replies View Related

General :: Parsing Output - End Of File Option ?

Feb 23, 2011

I'm working on a alias/script that will make it easier to look at my environment via the set command.

On my ubunto when running set it also displays some 10 pages of code pertaining to something called "imagemagik". at the end of the output. This code begins with the { character.

This is annoying if I want to look at my environment when working on scripts. How could I use something like grep, awk, sed, or whatever to ignore everything after the "{" character.

That seems to be the simplest way as long as there are no leading brackets in my environment. (And if you're thinking I should just remove {imagemagik}, I might just do that. But I still would like to know how to do this).

View 3 Replies View Related

Ubuntu Multimedia :: Cannot Select MP3 As An Output Output Option?

Jan 6, 2011

I am sure that this is very simple but I have installed sound juicer and the gstreamer plug ins. The problem is i still cannot select MP3 as an output output option

View 3 Replies View Related

General :: Can't Find "noclobber" Option To The "cp" Command?

Jun 15, 2011

I *think* I have used this command before: cp -np source destination

n - noclobber
p - preserve timestamps, etc

I must be remembering wrong because I can't find this "noclobber" option to the "cp" command. What am I thinking of?

View 6 Replies View Related

Programming :: Exec And Ssh : Command In Scripting?

Aug 4, 2010

I am a newbie, I am writing a script file to execute some programs.

# ! bin/ bash

clear

echo "*************************************"
echo " ACOUSTIC MODELLING - BELLHOP "
echo "*************************************"
#exec ssh automatix
code....

problem 1 : I can ssh to the required space but after the terminal prompts me for password it stops ececuting the script.

problem 2: after performing the 'exec' command for the first time. its not executing anything after that line. is there any work around for this.

View 1 Replies View Related

Programming :: `find . -exec' Handling Backticks In Bash

May 15, 2011

i had a problem with the find command in bash (which i deem is close enough to a promming language, if not please move this thread :P). i tried to reduce the command to the problem. i want the backticks, or $() for that matter; to be evaluated by -exec of find, not by bash. is that a caveat of find?

Code:

$ find testd -exec echo `basename {}` ; #confused me
test
test/a
test/b

[code]...

edit: i found out whats causing this. `basename {}` gets evaluated by bash before find is invoked, returns {} and `find . -exec echo {} ;" is run. now my question is, how to escape this eveluation from happening before.

View 11 Replies View Related

General :: Append Command Output To File By Giving Command In Terminal?

Jul 3, 2009

I am using openSUSE 10.3.When I install software from tarball then to record time required I send output of date to beg.txt(when installation begins) and end.txt (when installation finishes).How can I append output of date to a file so I don't need two files?

View 4 Replies View Related

Ubuntu Servers :: Resin Can't Find JAVA_HOME - Exec: 40: -jar: Not Found

Aug 21, 2010

I've been following the instructions to install Resin, and all seems to go well until I try to run the /bin/httpd.sh file. It simple says:

Code:

exec: 40: -jar: not found

I suspected this was something to do with my JAVA_HOME variable not being set, so I looked up how to do this and added it to my /etc/bash.bashrc file. Saying "echo $JAVA_HOME" does indeed return the correct path so I don't think this is the problem.

View 5 Replies View Related

Ubuntu :: Output Redirect With Crontab?

Sep 16, 2010

My Problem: The output redirection auf a script works if the script is called in the terminal but not when its called via crontab.

My Situation: I have 2 scripts:
~/backup1
Code:
echo backup a to c
rsync -a -v --progress --delete --exclude=.Trash-1000 /path/a/ /path/c/backup/
echo backup b to c

[Code]...

View 1 Replies View Related

Programming :: How To Redirect ALL Output To (log) File?

Aug 6, 2010

I am again struggling to make a script work, but hey, it is fun, I am learning new things. I discovered the set -x option which was, for me, like the second coming. Still, what I am not able to do is redirect ALL output to a (log) file, including what is produced by the -x setting. Let's assume a very simple script:
Code: #!/bin/bash
set -x
source="/home/atelier/Bureau/"
ls -la $source and I am running it as . test.sh >> /var/log/test.rmcb.log

The result of ls goes inded into the log file, but the rest still shows on the console where I am running the script: Code: ++ source=/home/atelier/Bureau/
++ ls --color=auto -la /home/atelier/Bureau/ Is there a way to redirect EVERYTHING to the log file ?

View 3 Replies View Related

General :: Redirecting Command Output To Input Of Another Command?

Jul 2, 2011

I want to run gsettings list-schemas (which return a list of about 100 names separated by spaces)and somehow direct each name one at a time as the input to this command:gsettings list-recursivelyI've tried it with awk, and standard | piping and also as a string variable strvar=$(gsettings list-schemas) and using the $strvar as the input butam missing something in between I'm sure like for - while or proper syntax of awk etc

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved