Programming :: Re-direct The Output Within An Awk Script?
Feb 27, 2011
I need to re-direct the output within an awk script, but not to already known, fixed filenames. The output file names depend on values of the fields. For example (the actual problem is surely more complicated), if, on a given line, the second field is DATA, the third is 1984, I would like to print some information in a file called output_DATA_1984. This could/would change in the following line of the same input file. Such things are pretty easy in bash, put I cannot do it in awk, as I can only find manual references for redirecting output to fixed filenames between double quotes.
View 2 Replies
ADVERTISEMENT
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
Nov 15, 2010
I would like to plug my guitar on my pc and hear what I'm playing out of my headphones. I have not found out yet how I can enable direct output. Neither with Line-In, nor Mic-Input worked. Has anyone an idea how to enable it? KMix does not provide such a function as far as I know
View 7 Replies
View Related
Apr 29, 2010
has no MTA (Postfix, Sendmail, Exim) installed so it can't email me the results of any cron job I schedule. I would then like to have the results from Cron be dumped into a small text file so I can read it later to view any issues.Right now my job is as follows:Code:01 18 * * * /usr/bin/shellscript.shAbove you see my script I want to run every day @ 6:01 pm. My question is what would the cron line look like if I wanted the results dumped into a random text file somewhere on my system?
View 1 Replies
View Related
Feb 17, 2009
How to re-direct image
View 1 Replies
View Related
Jul 26, 2011
I have a single board computer previously running DOS. I recently made Linux running on it. Now that the system is running Linux, I have to translate the code that was supported by DOS. The code has segments that allow direct access of memory mapped registers through the macro _MK_FP and do read/write. I have read that where DOS allows this kind of direct memory access, Linux does not. Is there a way to do this in Linux?
View 6 Replies
View Related
May 31, 2011
Any one using php program to direct lpt port print command, now i am creating one programe for mini shope that system having citizen CT-S4000 model.
View 2 Replies
View Related
May 28, 2010
How to Write a small shell script that adds an extension ".new" to all the files in a directory.
View 2 Replies
View Related
Jan 28, 2010
As i am new to C++ i couldn't figure out how to input a file and make some change on the file and produce a output file. like this problem i have is.
"Program that processes an input file and produces an output file. The input file will contain lines of data, each containing two floating point numbers. The lines of the output file should contain the two numbers read and their average (with a '$' sign and 2 places after the decimal point)."
View 2 Replies
View Related
Apr 25, 2010
I have a file with something like** The total time for processing is 1245 seconds *when I doawk 'BEGIN{FS="The total time for processing"} {print $2 } ' fileI get correctly on screen 1245 seconds *but when I try to direct this to a file awk 'BEGIN{FS="The total time for processing"} {print $2 } ' file > outputthenoutput is empty ie the 1245 seconds * is not saved in ...Know why?
View 4 Replies
View Related
May 10, 2010
With the command "tail -300 /var/log/apache2/access.log | less" i can look in the log for the 300 latest visitors. and i wanted to ask if it's possiblle to get that command to run from a php file and if yes how ?
View 4 Replies
View Related
Apr 6, 2011
Lex's (actually Flex) output contains this:
Code:
#ifdef __cplusplus
extern "C" int yywrap (void );
[code]...
View 8 Replies
View Related
Jun 8, 2010
I am trying to learn C Programing and I'm having trouble on the output of my script. my script should count the characters in input but it doesn't give me any numbers..
here's my program code:
Code:
#include <stdio.h>
main()
{
double nc;
[code]....
View 14 Replies
View Related
Feb 8, 2010
i am having problem with displaying my text. my text file is displayed in such a way and is called test.......
Code:
Sam Worthington ... Jake SullyasZoe Saldana ... NeytiriasSigourney Weaver ... Dr. Grace AugustineasStephen Lang ... Colonel Miles QuaritchasJoel Moore ... Norm Spellman (as Joel David Moore)asGiovanni Ribisi ... Parker SelfridgeasMichelle Rodriguez ... Trudy ChaconasLaz Alonso ... Tsu'teyasWes Studi ... EytukanasCCH Pounder ... MoatasDileep Rao ... Dr. Max PatelasMatt Gerald ... Corporal Lyle WainfleetasSean Anthony Moran ... Private FikeasJason Whyte ... Cryo Vault Med TechasScott Lawrence ... Venture Star Crew Chiefmore
What i am trying to do is for the program to read "as" and then from there start a new line... thus the expected output is...
Code:
Sam Worthington ... Jake Sully
Zoe Saldana ... Neytiri
Sigourney Weaver ... Dr. Grace Augustine
[code]....
I keep getting the error saying ...
Code:
editmain.cpp.98:error: initializer fails to determine size of 'str'
what does this mean, and how can i be able to format my file in the way i want?
View 2 Replies
View Related
May 6, 2010
have a file (called it A) contains;
hostname 192.168.23.65
hostname 10.18.13.253
hostname 10.18.16.253
[code]...
View 14 Replies
View Related
Jun 8, 2009
See the first program below :
Code:
This code when compiled gives the following errors:
1. conflicting types for 'fun' at line no: 9
2. previous declaration of 'fun' was here at line no: 3
Why is this happening?
If i modify the above program as shown in the second program below:
Code:
This code when compiled gives no errors.
Why the difference occurs between the first and second program?
View 8 Replies
View Related
Feb 25, 2011
is there a way in code to tell SDL to be directed to another desktop? This is so I can full screen debug rather than running in windowed mode. By other desktop I don't mean other machine just another workspace.*
* sorry don't know correct term for this it seems in Debian you have 4 you can select from the low right of the desktop, seems to be called desktop 1-2 in ubuntu.
View 1 Replies
View Related
Jun 10, 2010
I have a script that generates a bunch of output, including the expansions details provided by: set -v -xI am trying to pipe everything that is displayed to a file, in addition to displaying it on the screen. I've managed to get stderr and stdout into the file, but the expansions are only printed to the screen. Here is what I have so far:sudo -u <user> source my_job.sh |tee my_log.txt 2>&1
View 2 Replies
View Related
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
Mar 8, 2011
i'm programming a small widget for a panel and need some information from my system. The command on the shell would be whoami to find out which user i am. This information is needed for my widget to set up the title of the widget, the information of the user will be retrieved out of the /etc/passwd (the code works just fine), but i don't know how i can get the information. One possibility would be to create a child process, call whoami with execlp(). But how can i retrieve the output of that process?
View 3 Replies
View Related
Mar 10, 2010
How do I catch the output of split and redirect it to another directory?for example,if my working directory is 'Documents' and I split a file called text.one into 4 files of 100 lines each (xaa, xab, xac, xad), how would I get those split files to be written into 'Directory/subdirectory' instead of 'Directory'?And is it possible to rename those split files so that the split name is suffixed with the original file's name e.g instead of xaa, xab... can they be written as text.one.xaa, text.one.xab..?I've thought about using '>' to send the output to a new directory but it doesn't work; and I've thought about piping the results to another command but I don't know what that other command should be.
View 2 Replies
View Related
Apr 5, 2011
For instance, suppose I want to pipe the output of ps -A to a gtkdialog table.
View 1 Replies
View Related
Apr 7, 2009
I am trying to use a shell script to find a string in a file and do something when found. code...
What should happen is pppd will start in a different process and stream it's output to pppdout. pppdout should be created in the current folder. Then the script should periodically check the pppdout file for the string Script (which eventually will appear, some seconds later) and when found exit the script. Ultimately the script will do something useful when the text is found. However, the output from the program is a repeating: 'scriptname.sh: 12: FOUND: not found'
Where scriptname.sh would be the name of your script and 12 refers to the line with 'done'.
Why does grep not find the text, or at least why deos my script not check the grep output correctly?
View 10 Replies
View Related
Apr 23, 2010
i am trying to print the time in ms using the gettimeofday function, but on execution the shell gives: Segmentation fault (core dumped) error and leaves the program.. here is the code:
struct timeval time1,time2;
double time_used1;
//get time1
gettimeofday(&time1, NULL);
[code]....
View 3 Replies
View Related
May 3, 2011
I want to pipe the output of ls in a folder to a file (lets call it test.txt) but when i do so, but when i do ls > test.txt in test.txt there is also test.txt (logical
View 4 Replies
View Related
Jan 10, 2010
New to ubuntu and shell scripting in general... currently I stored some data into a text file. Right now, I would like to output the data from the text file and store it into a variable. Here's what I have so far:
READ_FILE=$(cat $FILE_NAME)
This definitely works and READ_FILE has the necessary data. However, this command will trigger an output to std output and I will see data on the screen, which is not what I want. I tried:
cat $FILE_NAME | $READ_FILE
and various other variants of this. It does not output to std output but neither does anything gets stored into $READ_FILE. I tried:
cat $FILE_NAME >> $READ_FILE
and it arrived at an error of "ambiguous redirect".
View 12 Replies
View Related
Feb 28, 2011
why isnt this working as i am expecting:
Code:
[schneidz@hyper temp]$ cat example.tmp
hello world
[code]....
View 1 Replies
View Related
Jun 13, 2010
The output of a command changed and I need to extract the data and print it out in a different fassion:
Code:
abcd1=aaaa xx
abcd 2 aaa xx bbb
abcd2=aaaa xy
ab 2 xx aaa bbb ccc xxx
should be transformed to:
[Code]...
Currently I used sed "search1|search2|search3" to get the lines that need to be transformed. But I also need to search for substrings in those lines and I need to print those substrings in a specific order together with other characters. How is this done with sed?
View 7 Replies
View Related
Jul 15, 2011
I'm testing some multi-plat java code and I'm getting a bit frustrated with the Linux tests. I need to run the command:
Code:
$ java -jar /home/developer/TCO/TabletComicOptimizer.jar <file> <args[]>
against all the files that match a specific criteria. I've tried various find syntax and I can't seem to get it right.
Normally I would just create a bash script and populate the results of find into an array and then just enumerate the collection but in this specific case I want to demonstrate this operation at the bash terminal.
I've tried things like:
Code:
~/TCO $ find . -type f -iname "*.cb[rz]" | xargs java -jar TabletComicOptimizer.jar {} 1200x1800 ;
Thinking that the {} is the substitution for each file returned by find but it's not working. How do I execute my java program against each result in the find operation?
View 6 Replies
View Related
Jul 24, 2010
Code:
I'm trying to make several files: each named after the display and containing resolutions. But for some reason I get null when trying to read lines.
View 2 Replies
View Related