Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Redirect output to the same input file in awk Post 302936365 by RavinderSingh13 on Wednesday 25th of February 2015 04:07:16 AM
Old 02-25-2015
Hello Stew,

Could you please try following and let me know if this helps.
Also my solution in POSt#2 also may help you in same.
Code:
awk '/kernel.sem/ { if ($3 < "300") { sub($3,"300",$0); print >> "/tmp/test1" } else {print >> "/tmp/test1" }}' /tmp/test

Here I am creating /tmp/test1 file as output, because file named /tmp/test is input file.

Hope this helps.

Thanks,
R. Singh
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Input file redirect in output path and want name as inputfilename_new.txt

not required this time (6 Replies)
Discussion started by: Sandeep_Malik
6 Replies

2. Shell Programming and Scripting

awk should output if one input file doesnt have matching key

nawk -F, 'FNR==NR{a= $3 ;next} $2 in a{print $1, 'Person',$2, a}' OFS=, filea fileb Input filea Input fileb output i am getting : (2 Replies)
Discussion started by: pinnacle
2 Replies

3. Shell Programming and Scripting

Pass input and output file as parameter to awk script

Hi, i am new to awk. I am using csv2pipe script(shown below) BEGIN { FS=SUBSEP; OFS="|" } { result = setcsv($0, ",") print } # setcsv(str, sep) - parse CSV (MS specification) input # str, the string to be parsed. (Most likely $0.) # sep, the separator between the values. # #... (6 Replies)
Discussion started by: bhaskarjha178
6 Replies

4. Programming

Redirect input and output to a shell script?

Dear All: I am trying to do something that (I thought) was relatively straightforward, but my code snippet does not seem to work. Any suggestions? Thank you Sincerely yours Misha Koshelev #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <errno.h> #include... (0 Replies)
Discussion started by: misha680
0 Replies

5. Shell Programming and Scripting

redirect an awk string output to a script input with pipes

Hi, I have a function in a bash script that returns a string after some operations using awk. The following code returns 555 $VARIABLE="EXAMPLE" get_number $VARIABLE this value I'd like to pass it as a second argument of another script with the following usage myscript.sh <param1>... (7 Replies)
Discussion started by: rid
7 Replies

6. UNIX for Advanced & Expert Users

Complex Input/Output Redirect

Hi All, Sorry if the title is not good but I did not know how to explain with only some words! What I meant is: I have a unix command built from a private application vendor that when executed it prompts for two entries by the keyboard, let's say, for example: ... (1 Reply)
Discussion started by: felipe.vinturin
1 Replies

7. Shell Programming and Scripting

AWK Script to convert input file(s) to output file

Hi All, I am hoping someone can help me with some scripting I need to complete using AWK. I'm trying to process multiple fixed files to generate one concatenated fixed file in a standard format. The Input file is:- aaaa bbbbb ccccc 1 xxxx aaa bbb aaaa bbbbb ccccc 2 abcd aaa CCC... (9 Replies)
Discussion started by: jason_v_brown
9 Replies

8. Shell Programming and Scripting

Read file from input and redirect to output file

Hi , i am having an file which contains 5 file_name data, i need to read the file name and will perform certain operation and generate out file names with named as 5 individual file_names for eg: file.txt contains file_name1.txt|hai file_name2.txt|bye file_name3.txt|how... (3 Replies)
Discussion started by: rohit_shinez
3 Replies

9. UNIX for Dummies Questions & Answers

awk - Rename output file, after processing, same as input file

I have one input file ABC.txt and one output DEF.txt. After the ABC is processed and created output, I want to rename ABC.txt to ABC.orig and DEF to ABC.txt. Currently when I am doing this, it does not process the input file as it cannot read and write to the same file. How can I achieve this? ... (12 Replies)
Discussion started by: High-T
12 Replies

10. Shell Programming and Scripting

awk to reformat output if input file is empty, but not if file has data in it

The below awk improved bu @MadeInGermany, works great as long as the input file has data in it in the below format: input chrX 25031028 25031925 chrX:25031028-25031925 ARX 631 18 chrX 25031028 25031925 chrX:25031028-25031925 ARX 632 14... (3 Replies)
Discussion started by: cmccabe
3 Replies
DEBUG_PRINT_BACKTRACE(3)						 1						  DEBUG_PRINT_BACKTRACE(3)

debug_print_backtrace - Prints a backtrace

SYNOPSIS
void debug_print_backtrace ([int $options], [int $limit]) DESCRIPTION
debug_print_backtrace(3) prints a PHP backtrace. It prints the function calls, included/required files and eval(3)ed stuff. PARAMETERS
o $options - As of 5.3.6, this parameter is a bitmask for the following options: debug_print_backtrace(3) options +----------------------------+---------------------------------------------------+ |DEBUG_BACKTRACE_IGNORE_ARGS | | | | | | | Whether or not to omit the "args" index, and | | | thus all the function/method arguments, to save | | | memory. | | | | +----------------------------+---------------------------------------------------+ o $limit - As of 5.4.0, this parameter can be used to limit the number of stack frames printed. By default ($limit= 0) it prints all stack frames. RETURN VALUES
No value is returned. CHANGELOG
+--------+-----------------------------------------+ |Version | | | | | | | Description | | | | +--------+-----------------------------------------+ | 5.4.0 | | | | | | | Added the optional parameter $limit. | | | | | 5.3.6 | | | | | | | Added the optional parameter $options. | | | | +--------+-----------------------------------------+ EXAMPLES
Example #1 debug_print_backtrace(3) example <?php // include.php file function a() { b(); } function b() { c(); } function c(){ debug_print_backtrace(); } a(); ?> <?php // test.php file // this is the file you should run include 'include.php'; ?> The above example will output something similar to: #0 c() called at [/tmp/include.php:10] #1 b() called at [/tmp/include.php:6] #2 a() called at [/tmp/include.php:17] #3 include(/tmp/include.php) called at [/tmp/test.php:3] SEE ALSO
debug_backtrace(3). PHP Documentation Group DEBUG_PRINT_BACKTRACE(3)
All times are GMT -4. The time now is 10:34 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy