Sponsored Content
Top Forums Shell Programming and Scripting awk how to replace specific field with new value Post 302511448 by setepo on Wednesday 6th of April 2011 07:53:30 PM
Old 04-06-2011
Thanks, it works.

But I have set of data and in every file instead of "x" is different number. I need to clear this field and after that fill with new value for example 100 (for all data sets).

data 1

0 0 0 0
0 3 0 0
0 0 0 0

data 2

0 0 0 0
0 1 0 0
0 0 0 0

data 3

0 0 0 0
0 8 0 0
0 0 0 0

output

0 0 0 0
0 100 0 0
0 0 0 0
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk to replace particular field

i have bad data for instance, the use of capital letters in the middle of the word. I identified the errors, made a list and put it in a file error_correction.txt Incorrect,Correct VeNOM,Venom nos,NOS . . . My data file looks like this: vgr,bugatti veron,,3.5,Venom,6,.......,....... (14 Replies)
Discussion started by: VGR
14 Replies

2. Shell Programming and Scripting

Awk to replace a field

Hi I am using awk to replace the 4th feild of the input line. My code is below: REP_LINE=$(echo $Line | awk -v var=$REPL_DT '{$4=var; print}') It does replaces but all words/phrases after the 4th feild are erased. Is there a way to modify the 4th feild of the input line and to have all... (7 Replies)
Discussion started by: sugan
7 Replies

3. Shell Programming and Scripting

Replace specific field on specific line sed or awk

I'm trying to update a text file via sed/awk, after a lot of searching I still can't find a code snippet that I can get to work. Brief overview: I have user input a line to a variable, I then find a specific value in this line 10th field in this case. After asking for new input and doing some... (14 Replies)
Discussion started by: crownedzero
14 Replies

4. Shell Programming and Scripting

awk search/replace specific field, using variables for regexp & subsitution then overwrite file

Hello, I'm trying the solve the following problem. I have a file which I intend to use as a csv called master.csv The columns are separated by commas. I want to change the text on a specific row in either column 3,4,5 or 6 from xxx to yyy depending upon if column 1 matches a specified pattern.... (3 Replies)
Discussion started by: cyphex
3 Replies

5. Shell Programming and Scripting

AWK replace one field

I have some problem with this. Need to change field #3 to 5 if field #1 = A and filed #2 =B DataA C 6 T C B 4 R A B 3 T D E 5 4 I would like to do two things if statement is true, but can not get it to work. Here it prints column #3 if statement is true, and this works awk '{if... (3 Replies)
Discussion started by: Jotne
3 Replies

6. Shell Programming and Scripting

How to print with awk specific field different from specific character?

Hello, i need help with awk. I have this file: cat number DirB port 67 er_enc_out 0 er_bad_os 0 DirB port 71 er_enc_out 56 er_bad_os 0 DirB port 74 er_enc_out 0 er_bad_os 0 DirB port 75 ... (4 Replies)
Discussion started by: elilmal
4 Replies

7. UNIX for Dummies Questions & Answers

How to replace and remove few junk characters from a specific field?

I would like to remove all characters starting with "%" and ending with ")" in the 4th field - please help!! 1412007819.864 /device/services/heartbeatxx 204 0.547%!i(int=0) 0.434 0.112 1412007819.866 /device/services/heartbeatxx 204 0.547%!i(int=1) 0.423 0.123... (10 Replies)
Discussion started by: snemuk14
10 Replies

8. Shell Programming and Scripting

awk to replace a specific field in certain condition

Hi, I have a file like below PRUM,67016800 ,CC ,C1,67016800 , ,Y,Y,2 ,CK,BX,FOX ,00000001,EA,00000001,20141120 00:00:00, ,N,Y,Y,CK ABCDEF... (7 Replies)
Discussion started by: mady135
7 Replies

9. Shell Programming and Scripting

awk - how to print specific field if a string is matched

hi gurus, I would like to be able to use awk to process 1 file as such: abc 1 2 3 4 5 6 7 8 9 10 flags 1 2 4 flags 1 2 5 abc 2 3 4 5 6 7 8 9 10 11 flags 1 2 3 abc 4 5 6 7 8 9 6 7 78 89 flags 1 2 3 flags 1 2 4 flags 1 2 3 4 I would like to be able to print field 1 and 5 when the... (4 Replies)
Discussion started by: revaroo
4 Replies

10. Shell Programming and Scripting

awk to add symbol to specific field

Trying to use awk to add a . to $4. The input and output is tab-delimeted, but the awk seems to add a . in front of $5 and is space-delimeted. It seems close, but I am not able to produce the desired output. Thank you :). file chr1 948895 949015 chr1:948895-949015 ISG15 chr1 ... (1 Reply)
Discussion started by: cmccabe
1 Replies
YAGI(5) 							File Formats Manual							   YAGI(5)

NAME
yagi - yagi binary output format DESCRIPTION
This manual page describes the output format of the file created by the Yagi-Uda project's yagi program. The file is a binary file with a header of 100 bytes. The header consists of: offset(bytes) information data-type 0 elements int 4 driven int 8 parasitic int 12 min_frequency double 20 max_frequency double 28 design frequency double 36 step_frequency double 44 angular_step double 52 0 double 92 0 double Following the header, there starts the coordinates(x,y,l) of each element and the voltage applied to each element. Then we write the element currents one after the other, at each frequency. Hence the element currents will be written 12,000 times with a 3 element yagi analysed at 4,000 different frequencies. All complex data is stored in a structure of type fcomplex, defined as: struct fcomplex {double real, double imaginary}; offset(bytes) information data-type 100 x1 double /* coordinates */ 108 y1 double 116 l1 double 100+(n-1)*24 x_n double 100+(n-1)*24+8 y_n double 100+(n-1)*24+16 l_n double -------------- Repeated for each element. 100+24*elements Voltage1 fcomplex /* voltage */ 100+24*elements+(n-1)*16 Voltage_n fcomplex -------------- Repeated for each element n at each frequency step f. 100+40*elements Current1@f1 fcomplex /* current */ 100+40*elements+(n-1)*16 Current_n@f1 fcomplex 100+56*elements Current@f2 fcomplex 100+40*elements+(n-1)*16 Current_n@f2 fcomplex FILES
filename.out binary file SEE ALSO
yagi(1), output(1), input(1), optimise(1), first(1) and input(5). AUTHORS
Dr. David Kirkby G8WRB (david.kirkby@onetel.net), with help with converting to DOS from Dr. Joe Mack NA3T (mack@fcrfv2.ncifcrf.gov). Yagi version 1.16 24th October 2000 YAGI(5)
All times are GMT -4. The time now is 06:40 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy