Stdout in file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Stdout in file
# 1  
Old 10-05-2013
Stdout in file

I cannot figure out what is wrong.... I have 3 files with IP addresses:
file1 134.123.3.236
file2 134.123.3.235
file3 134.123.5.237
I type "prob1 Oops x2x3x4". Then my code creates file with name Oops and first line x2x3x4. Moreover, my code generate IP and it gives to file Oops as a second line. In addition, my code looks at all files with IP addresses compare and give next own IP. For example, the maximum according to third and fourth oct is file3 with his IP! So I need to create Oops file with 134.123.5.238 (254 is a max ) as a second line.

Last edited by Manu1234567; 10-10-2013 at 10:49 PM..
# 2  
Old 10-06-2013
You certainly need the 4th oct plus 1 in either case, i.e. in the awk code m4=$4+1
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Output of until to file versus stdout

Why does this until false; do history | head -5; done result in a stdout infinite loop, yet until false; do history | head -5 > hist5; done only writes it once to file hist5? Furthermore, I can hear the hard drive working on the 2nd command until I end the process, but the history | head -5 is... (1 Reply)
Discussion started by: Xubuntu56
1 Replies

2. Shell Programming and Scripting

Redirecting STDERR to file and screen, STDOUT only to file

I have to redirect STDERR messages both to screen and also capture the same in a file but STDOUT only to the same file. I have searched in this formum for a solution, but something like srcipt 3>&1 >&2 2>&3 3>&- | tee errs doesn't work for me... Has anyone an idea??? (18 Replies)
Discussion started by: thuranga
18 Replies

3. Shell Programming and Scripting

Redirecting stdout continously to a file

I have a C program that continously outputs info to stdout. The problem is that I am redirecting the stdout and stderr to a file and stdout is written at the end of the problem rather than continously to the file. This could be a problem if for example the program is killed and the stdout output is... (3 Replies)
Discussion started by: igurov
3 Replies

4. Programming

stderr stdout to a log file

I originally wrote my script using the korn shell and had to port it to bash on a another server. My script is working find for backing up but noticed that now after the move, I am not getting any output to my log files. Using Korn shell, this worked for me for some odd reason. This was sending... (2 Replies)
Discussion started by: metallica1973
2 Replies

5. Shell Programming and Scripting

Print to both file and stdout

Using echo command, send output to both places. I think I knew this but forgot. Thanks in advance (2 Replies)
Discussion started by: stevensw
2 Replies

6. UNIX for Dummies Questions & Answers

unzip single file in zip file to STDOUT

Hi, Does anyone know if there is an unzip command similar to tar -xOf $tarBall $fileInTarFile which will untar a single file in a tar ball to STDOUT ? I want to do the same but with a .zip (ZIP archive) file. - Andy ---------- Post updated at 05:56 PM ---------- Previous update... (0 Replies)
Discussion started by: andyatit
0 Replies

7. Shell Programming and Scripting

Alter file descriptor for stdout

Is there a way to alter the file descriptor for stdout.? sample: #!/bin/ksh exec 1>file exec 2>file echo hi --------->This will go to file print -u4 "come statement"---->I want to make the file descriptor 4 to point to stdout. The reason is ,I have a script which has lot of db2... (1 Reply)
Discussion started by: prasperl
1 Replies

8. Shell Programming and Scripting

StdOut to file --> Append Mode

Hy I've got a little problem: I work with ksh... The application I start should write its output to a log file. It works but the problem is that as I have to run this application few times in a loop it overrites the file every time.:confused: /proj/bre/tools/bin/bretestdriver... (2 Replies)
Discussion started by: lucae
2 Replies

9. Shell Programming and Scripting

implicitly redirecting stdout to a file

Is there a way to redirect all stdout to a file implicitly - like defining stdout=/home/me/process.log - so that all "echo" commands in several scripts/subscripts are written to that file; instead of having to edit all scripts to redirect the "echo" (e.g. echo 'This is a test ' >>... (1 Reply)
Discussion started by: ALTRUNVRSOFLN
1 Replies

10. UNIX for Advanced & Expert Users

problem with redirect stdout to file

Hi all hope you can help as I am going MAD!!! :eek: The below is in a shell script but the redirection in the sed line does not work and outputs to the screen and the $fname_2 does note get created ????? Can any one help ?? #!/bin/ksh cd /app/ for fname in `ls -1 X*` do sed 1d $fname... (3 Replies)
Discussion started by: mlucas
3 Replies
Login or Register to Ask a Question