Sponsored Content
Top Forums Shell Programming and Scripting Help with Awk finding and replacing a field based on a condition Post 302519653 by jghi123 on Wednesday 4th of May 2011 02:22:06 PM
Old 05-04-2011
thanks =)

data integrity issue

column $108 acutally had a space after the T

---------- Post updated at 02:22 PM ---------- Previous update was at 02:21 PM ----------

Code:
 awk 'BEGIN{OFS=FS="|"} /\|T.$/{$98="T"}1'

works
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Update a field in a file based on condition

Hi i am new to scripting. i have a file file.dat with content as : CONTENT_STORAGE PERCENTAGE FLAG: /storage_01 64% 0 /storage_02 17% 1 I need to update the value of FLAG for a particular CONTENT_STORAGE value I have written the following code #!/bin/sh threshold=20... (1 Reply)
Discussion started by: kichu
1 Replies

2. Shell Programming and Scripting

Replacing the text in a row based on certain condition

Hi All, I felt tough to frame my question. Any way find my below input. (.CSV file) SNo, City 1, Chennai 2, None 3, Delhi 4,None Note that I have many rows ans also other columns beside my City column. What I need is the below output. SNo, City 1, Chennai 2, Chennai_new 3, Delhi... (2 Replies)
Discussion started by: ks_reddy
2 Replies

3. Shell Programming and Scripting

Finding/replacing strings in some files based on a file

Hi, We have a file (e.g. a .csv file, but could be any other format), with 2 columns: the old value and the new value. We need to modify all the files within the current directory (including subdirectories), so find and replace the contents found in the first column within the file, with the... (9 Replies)
Discussion started by: Talkabout
9 Replies

4. Shell Programming and Scripting

awk to update value in field based on another field

In the tab-delimeted input file below I am trying to use awk to update the value in $2 if TYPE=ins in bold, by adding the value of HRUN= in italics. In the below since in line 1 TYPE=ins the 117282541 value in $2 has 6 added because that is the value of HRUN=. Hopefully the awk is a start but I... (2 Replies)
Discussion started by: cmccabe
2 Replies

5. Shell Programming and Scripting

awk to adjust coordinates in field based on sequential numbers in another field

I am trying to output a tab-delimited result that uses the data from a tab-delimited file to combine and subtract specific lines. If $4 matches in each line then the first matching sequential $6 value is added to $2, unless the value is 1, then the original $2 is used (like in the case of line... (3 Replies)
Discussion started by: cmccabe
3 Replies

6. UNIX for Beginners Questions & Answers

Replacing tag based on condition

Hi All, I am having a file like below. The file will having information about the records.If you see the file the file is header and data. For example it have 1 men tag and the tag id will be come after headers. The change is I want to convert All pets tag from P to X. I did a sed like below... (5 Replies)
Discussion started by: arunkumar_mca
5 Replies

7. Shell Programming and Scripting

Replacing field based on the value of other field

Hi Team, In the below input file, if I have the value 23,24,25 then for those records 1st field value should get updated from "a" to "b". I also want to pass these values in file as input as it can be done dynamically. Tried awk commands but not getting desired output.Using SunOS 5.10 version.... (14 Replies)
Discussion started by: weknowd
14 Replies

8. Shell Programming and Scripting

awk to change contents of field based on condition in same file

In the awk below I am trying to copy the entire contents of $6 there may be multiple values seperated by a ;, to $8, if $8 is . (lines 1 and 3 are examples). If that condition $8 is not . (line2 is an example) then that line is skipped and printed as is. The awk does execute but prints the output... (3 Replies)
Discussion started by: cmccabe
3 Replies

9. UNIX for Beginners Questions & Answers

Change the field color based on condition in email

Request your help to change the field color based on condition , if it is otherthan 0. using html in unix. Here is my condition for(i=1;i<=NF;i++) { print "<td> "$i"</td> } Please use CODE tags when displaying sample input, output, and code segments. (17 Replies)
Discussion started by: CatchMe
17 Replies

10. UNIX for Beginners Questions & Answers

Problem with getting awk to multiply a field by a value set based on condition of another field

Hi, So awk is driving me crazy on this one. I have searched everywhere and read man, docs and every related post Google can find and still no luck. The actual files I need to run this on are sensitive in nature, but it is the same thing as if I needed to calculate weighted grades for multiple... (15 Replies)
Discussion started by: cotilloe
15 Replies
SoFieldSensor(3)						       Coin							  SoFieldSensor(3)

NAME
SoFieldSensor - The SoFieldSensor class detects changes to a field. Attach a field to a sensor of this type to put it under surveillance, so you can act upon changes to the field. SYNOPSIS
#include <Inventor/sensors/SoFieldSensor.h> Inherits SoDataSensor. Public Member Functions SoFieldSensor (void) SoFieldSensor (SoSensorCB *func, void *data) virtual ~SoFieldSensor (void) void attach (SoField *field) void detach (void) SoField * getAttachedField (void) const virtual void trigger (void) Additional Inherited Members Detailed Description The SoFieldSensor class detects changes to a field. Attach a field to a sensor of this type to put it under surveillance, so you can act upon changes to the field. An SoFieldSensor can also act for delete-callback purposes alone and does not need a regular notification-based callback. Constructor &; Destructor Documentation SoFieldSensor::SoFieldSensor (void) Constructor. SoFieldSensor::SoFieldSensor (SoSensorCB *func, void *data) Constructor taking as parameters the sensor callback function and the userdata which will be passed the callback. See also: setFunction(), setData() SoFieldSensor::~SoFieldSensor (void) [virtual] Destructor. Member Function Documentation void SoFieldSensor::attach (SoField *field) Attach sensor to a field. Whenever the field's value changes, the sensor will be triggered and call the callback function. A field sensor can be attached to only a single field at a time. When this method is invoked multiple times, each subsequent call will replace the field the sensor is monitoring with the new field. When the given field is deleted, the sensor will automatically be detached. See also: detach() void SoFieldSensor::detach (void) Detach sensor from field. As long as an SoFieldSensor is detached, it will never call its callback function. See also: attach() SoField * SoFieldSensor::getAttachedField (void) const Returns a pointer to the field connected to the sensor. See also: attach(), detach() void SoFieldSensor::trigger (void) [virtual] Trigger the sensor's callback function. Reimplemented from SoDataSensor. Author Generated automatically by Doxygen for Coin from the source code. Version 3.1.3 Wed May 23 2012 SoFieldSensor(3)
All times are GMT -4. The time now is 06:12 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy