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


ADVERTISEMENT

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

Ubuntu :: Redirect Curl Output To Multiple Files?

Nov 6, 2010

I am using curl as the following

Code:
curl "http://site.com/pages/{1,2,3,4,5}.html" > /home/myuser/allpages.html
i need to save each page in a separate page by the way i have tried this command
Code:
curl "http://site.com/pages/{1,2,3,4,5}.html" > /home/myuser/{1,2,3,4,5}.html
but it displays error
Code:
ambiguous redirect
is there any way to do that

View 5 Replies View Related

Programming :: Redirect The Output To Multiple Files Without Displaying It To The Screen?

Oct 26, 2010

To redirect standard output to multiple files:

Code:

echo Test | tee file1 file2

My problem is that the word "Test" still displays to the screen? I want same effect as:

Code:

echo Test > file1

but with multiple file redirection.

View 3 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 :: 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 :: 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

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

Hardware :: Multiple Barcode Scanners - Can't Seem To Redirect Output From One To A Specific Instance Of My Program

Sep 30, 2010

I have nine barcode scanners, each of whose input I want to send to a separate instantiation of a program I wrote. Each device shows up as /dev/hidraw_ (I'm using Ubuntu 10.4). The problem is that they all act as simple keyboard input, and I can't seem to redirect the output from one to a specific instance of my program. I've tried something like cat /dev/hidraw5 > ./myapp, and that doesn't work. I've tried actually opening the device in my program using open("/dev/hidraw5"), and it returns success, but subsequent reads don't do anything, and the scanner output is just printed to the console.

View 1 Replies View Related

OpenSUSE Multimedia :: Output One Playback Stream To Multiple Devices Simultaneously With The Current PulseAudio / Phonon Setup?

Jun 9, 2011

Is it possible to output one playback stream to multiple devices simultaneously with the current PulseAudio / Phonon setup? The PulseAudio mixer only has radio buttons to choose one device per playback stream. I believe the hardware is capable of this, since I remember doing that before we had PulseAudio. How can I duplicate an audio stream?

Here's one application scenario: I am travelling with my family, all crammed in small hotel room. My wife and me want to watch a movie on my laptop without waking up our kids. I just happen to have one analogue headphone available and one wireless USB headset with me. (Of course, the low tech solution is to bring an 3,5mm Y-cable to attach two analogue headsets, but I would really love to use the USB headset together with the analogue one.)

Another similar thing that bugs me is that my laptop's built-in speakers now always seem dead when an analogue headphone is plugged in. This is mostly what one wants, and before PulseAudio, one had to manually switch them off which was generally annoying. However, the downside is for example with notifications.

For example, before PulseAudio, I could configure Skype to always ring over the laptop's built-in speakers, regardless of whether the analogue headphones were plugged in. This is no longer possible, since PulseAudio does not distinguish between built-in speakers and built-in analogue port any more, while old Alsa did. So in my office, where some analogue headphones are plugged into the docking station, I never hear Skype ringing if I don't wear the headphones.

View 9 Replies View Related

Programming :: Redirect Output To Files Using Shell?

May 21, 2011

I have a huge database of students, I would like extract these data and write to individual file for each students.

I am running a loop in shell program (.sh file), the output of each run in the loop need to redirected to a file with variable name.

I tried the following line, but it did not work, where BodyMsg is the data and Rollno is the students roll number.

echo $BodyMsg > $RolNo".html"

View 5 Replies View Related

Programming :: Redirect To Multiple Files?

Nov 12, 2010

I feel kind of embarrassed posting here, but this is technically a scripting sub-forum. Here is the problem. I have a folder with various files which include .txt files as well

How can i redirect same content to each of the .txt files in the folder?

I have tried
Code: $ echo "hello" > *.txt
-bash: !": event not found Code: also cat ~/otherdir/test.txt > *.txt
-bash: *.txt: ambiguous redirect Can anyone help me with this?Ok i solved it
Code: #! /bin/bash
for file in *.txt
do
echo "Text that needs to be written" > $file
done

View 2 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

Ubuntu :: Output Redirect To A File After A Line?

Mar 9, 2011

I want to redirect the output of a command to a file, but not at the end of the file, but after a line. Do you know how can I do it?

Something like:

cat file_a | grep some_text >> resulting_file

# in this file I need to place the output from grep, but not at the bottom of resulting_file, like it would normally happen, but after line .. 3 , for example

Then, if file_a is:

abc x
some_text q
zxc w

[Code]....

View 2 Replies View Related

Ubuntu :: Redirect Output To A File And To The Console?

Apr 11, 2011

I'd like to redirect the output to a file and to the console. I know about tee but the issue is that it waits until the first process finishes.e.gecho "hello world" | tee test.txtfirst calls echo and then tee.Is there a way to redirect "on the fly" ?

View 5 Replies View Related

General :: Redirection Rules For "redirect URL" Identifier?

Jan 20, 2010

I need to redirect h[URL]But when it gets [URL]eans it's not redirecting with identifier "redirectUrl=".How to rewrite to that as well

View 1 Replies View Related

Ubuntu :: Redirect Output Of Xorg -configure To A File?

Jun 29, 2010

Ubuntu 10.04

I booted to command line only and entered the following command: Sudo Xorg -configure > xorglog.txt

the command seems to run just fine and does create a new xorg.conf.new file but I would like to see all the output of the Xorg -configure command but it just scrolls by too fast and I can't go back to see it. Hence this is why I'm trying to do the > . It seems to ignore the >.

how I can see what the command is doing?

View 4 Replies View Related

Programming :: Bash - Redirect All Subsequent Std Output To File?

Feb 11, 2010

I have got a script with an outer and inner loop. The inner loop issues loads of echo's which need to be redirected to a log file determined by the outer loop. The obvious solution is to redirect every echo to >$LOG and set LOG in the outer loop.

Code:

for f in $FILES ; do
LOG=<logfile>
for l in $LINES ; do

[code]....

it is possible to map stdout to $LOG in the outer loop without having to redirect every subsequent individual command output?

View 4 Replies View Related

Programming :: Shell Script - Redirect Output To File

Sep 6, 2010

I did a select on my db and now I need that this if consult return true for me salve the columns information in file. How I do this in Shell?!

View 3 Replies View Related

Software :: Redirect ALL Terminal Output To File And Screen (for Entire Session)?

Jul 6, 2010

Is there one command that will let me record an entire terminal session (with any possible errors) to a text file while also seeing all output on screen too? I know it can be done for individual commands, but I'm looking to do this for an entire session where the individual commands will be normal (i.e., not piped into tee, etc.). It would be even better if the command prompt is captured too. The obvious utility of this makes me think someone surely has come up with a solution long ago (probably in the 60's).(I'm sure it goes without saying, but subsequent output in that session should be appended to the file. The file should contain the full history, with all output and errors, of the session.)

View 9 Replies View Related

General :: Program That Reads Multiple Pipes / File Descriptors And Writes To Standard Output

Feb 23, 2011

Is there already a program that reads multiple pipes or file descriptors and writes to the standard output (not splitting lines).Like cat, but reading all files simultaneously and preserving lines.It is needed to avoid coding of select/epoll loops or using multithreading in simple programs. Like "select loop for bash".

View 1 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 :: 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 :: How Display Part Of An Output Stream

Feb 4, 2011

Though I have little experience in the past, i just can't get to work what i have in mind.i want to display part of an output stream.

cat sample.xml
<packet or="recv" ljid="d.sample@test.local/" ts="20110204T15:02:55"><message from='j.sample2@test.local/' to='d.sample@test.local' type='chat' xml:lang='en' id='sd61'>

[code]...

View 4 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 :: Windows - Use A Computers (would Be) Audio Output As A Stream?

Feb 28, 2010

I have two machines on a local area network (xp box and xubuntu box) and I want audio from both machines to be played from the same set of speakers. The problem is, the xubuntu machine doesn't have any sound output. There is no onboard sound card and all expansion slots are pci-x, so short of buying a pci-x sound card my only option for playing sound is to route audio through LAN to my xp computer.

I already have a program that will let me play music on one computer from another's speakers, but I am trying to set up a stream so that games and internet sound can be heard. Is it possible for me to do this?

View 1 Replies View Related

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 View Related

General :: Show The Output Of Several Vi Files In A Single File?

Jan 3, 2011

i have 10 vi files . these files contain some system related information. i need to combine the output of all these files into a single file. the final file should contain contents of all these 10 files and the output should be in a tabular format.

is there any command in vi that i can use to create a table ?

View 9 Replies View Related







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