Sponsored Content
Top Forums Shell Programming and Scripting Remove part of a string from second field Post 302556944 by rajv on Tuesday 20th of September 2011 06:59:32 AM
Old 09-20-2011
Error Remove part of a string from second field

I have a file in below format (pipe delimited):
Code:
1234__abc|John__abc|xyz
3345__abc|Kate__abc|xyz
55344|Linda__abc|xyz
33434|Murray|xyz

I want to remove any occurence of "__abc" in the second field of this file.
I did some research and found a way to replace the entire second field with another string:
Code:
sed 's/^\([^|]*\)|[^|]*|/\1|9999|/'

But I am not able to remove the "__abc" alone in the second field. Any help to do this would me much appreciated.

Last edited by Scott; 09-20-2011 at 08:02 AM.. Reason: Added code tags
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Moving Part of a field to another field using AWK

Hi there, I have a comma seperated file with nine fields the fields are rerate: "numberTX",field2,field3,field4,field5..... I want to do this to the file reate: "field5TX",field2,field3,field4,field5 I know I can do this using AWK, but the thing giving me fits is that I... (5 Replies)
Discussion started by: rjsha1
5 Replies

2. Shell Programming and Scripting

Extract Part of string from 3rd field $3 using AWK

I'm executing "wc -lc" command in a c shell script to get record count and byte counts and writing them to a file. I get the result with the full pathname of the file. But I do not want the path name to be printed in the output file. I heard that using Awk we can get this but I don't have any... (4 Replies)
Discussion started by: stakuri
4 Replies

3. Shell Programming and Scripting

remove last field from string

Hi everybody! I want to cut the last field from string, can anybody help me?? String input:: /abc1/abc2/abc3 output:: /abc1/abc2 Regards, Kiran (2 Replies)
Discussion started by: dddkiran
2 Replies

4. Shell Programming and Scripting

How to select or make reference to, part of a field

For a field format such as AAL1001_MD82, how do I select(and use in if statement) only the last four elements( in this case MD82) or the first three elements (in this case AAL)? For instance, how do I do the following - if first three elements of $x == yyy, then ... (5 Replies)
Discussion started by: akshaykr2
5 Replies

5. Shell Programming and Scripting

Trying to use sed to remove the value of one field from another field

I'm trying to use sed to remove the value of one field from another field. For example: cat inputfile 123|ABC|Generic_Textjoe@yahoo.com|joe@yahoo.com|DEF 456|GHI|Other_recordjohn@msn.com|john@msn.com|JKL 789|MNO|No_Email_On_This_One|smith@gmail.com|PQR I would like to remove the email... (2 Replies)
Discussion started by: bribri87
2 Replies

6. Shell Programming and Scripting

Awk Search text string in field, not all in field.

Hello, I am using awk to match text in a tab separated field and am able to do so when matching the exact word. My problem is that I would like to match any sequence of text in the tab-separated field without having to match it all. Any help will be appreciated. Please see the code below. awk... (3 Replies)
Discussion started by: rocket_dog
3 Replies

7. Shell Programming and Scripting

awk and get a part of field ?

I have a list of log.txt, thisis a flatfile separate by a pipe | 2012/06/23 18:58:15 | 4:sabercats pid=020272 opened Boards 0, 1, 2, 3 for /home/directory_germany/germany/location/qt/NET12/full_111_ddr5_soq523_2X_FV_4BD_PD3_0.qt/dbFiles/germany.proto |berlin|test1|test2 2012/06/25 17:40:56... (2 Replies)
Discussion started by: sabercats
2 Replies

8. Shell Programming and Scripting

[Solved] sort on numeric part of field

I have ran into a heavy case of PEBCAK*) and could need some advice on what i do wrong: OS is Linux (kernel 2.6.35), sort --version reports "8.5" from 2010, shell is ksh. Originally i had a file with with the following structure: hdisk1 yyy hdisk2 yyy hdisk3 yyy hdisk4 yyy hdisk5 yyy... (2 Replies)
Discussion started by: bakunin
2 Replies

9. Linux

How do I format a Date field of a .CSV file with multiple commas in a string field?

I have a .CSV file (file.csv) whose data are all enclosed in double quotes. Sample format of the file is as below: column1,column2,column3,column4,column5,column6, column7, Column8, Column9, Column10 "12","B000QRIGJ4","4432","string with quotes, and with a comma, and colon: in... (3 Replies)
Discussion started by: dhruuv369
3 Replies

10. Shell Programming and Scripting

Print particular string in a field of csv file - part 2

Hi, all I need your help and suggestions. I want to print particular strings in a field of a csv file and show them in terminal. Here is an example of the csv file. SourceFile,Airspeed,GPSLatitude,GPSLongitude,Temperature,Pressure,Altitude,Roll,Pitch,Yaw... (7 Replies)
Discussion started by: refrain
7 Replies
SoMFVec3d(3)							       Coin							      SoMFVec3d(3)

NAME
SoMFVec3d - The SoMFVec3d class is a container for SbVec3d vectors. This field is used where nodes, engines or other field containers needs to store an array of vectors with three elements. SYNOPSIS
#include <Inventor/fields/SoMFVec3d.h> Inherits SoMField. Public Member Functions virtual SoType getTypeId (void) const virtual void copyFrom (const SoField &field) const SoMFVec3d & operator= (const SoMFVec3d &field) virtual SbBool isSame (const SoField &field) const const SbVec3d & operator[] (const int idx) const const SbVec3d * getValues (const int start) const int find (const SbVec3d &value, SbBool addifnotfound=FALSE) void setValues (const int start, const int num, const SbVec3d *newvals) void set1Value (const int idx, const SbVec3d &value) void setValue (const SbVec3d &value) const SbVec3d & operator= (const SbVec3d &val) SbBool operator== (const SoMFVec3d &field) const SbBool operator!= (const SoMFVec3d &field) const SbVec3d * startEditing (void) void finishEditing (void) void setValuesPointer (const int num, const SbVec3d *userdata) void setValuesPointer (const int num, SbVec3d *userdata) void setValuesPointer (const int num, const double *userdata) void setValuesPointer (const int num, double *userdata) void setValues (int start, int num, const double xyz[][3]) void set1Value (int idx, double x, double y, double z) void set1Value (int idx, const double xyz[3]) void setValue (double x, double y, double z) void setValue (const double xyz[3]) Static Public Member Functions static void * createInstance (void) static SoType getClassTypeId (void) static void initClass (void) Protected Member Functions virtual void deleteAllValues (void) virtual void copyValue (int to, int from) virtual int fieldSizeof (void) const virtual void * valuesPtr (void) virtual void setValuesPtr (void *ptr) virtual void allocValues (int num) Protected Attributes SbVec3d * values Detailed Description The SoMFVec3d class is a container for SbVec3d vectors. This field is used where nodes, engines or other field containers needs to store an array of vectors with three elements. See also: SbVec3d, SoSFVec3d, SoMFVec3f Member Function Documentation SoType SoMFVec3d::getClassTypeId (void) [static] Returns a unique type identifier for this field class. See also: getTypeId(), SoType Reimplemented from SoMField. SoType SoMFVec3d::getTypeId (void) const [virtual] Returns the type identification instance which uniquely identifies the Coin field class the object belongs to. See also: getClassTypeId(), SoType Implements SoField. void SoMFVec3d::copyFrom (const SoField &f) [virtual] Copy value(s) from f into this field. f must be of the same type as this field. Implements SoField. SbBool SoMFVec3d::isSame (const SoField &f) const [virtual] Check for equal type and value(s). Implements SoField. void SoMFVec3d::deleteAllValues (void) [protected], [virtual] This API member is considered internal to the library, as it is not likely to be of interest to the application programmer. Implements SoMField. void SoMFVec3d::copyValue (intto, intfrom) [protected], [virtual] This method is used for moving values around internally within a multivalue field. It needs to be overridden in each field so it automatically takes care of running copy contructors where necessary. Implements SoMField. const SbVec3d* SoMFVec3d::getValues (const intstart) const [inline] Returns a pointer to the values array. void SoMFVec3d::initClass (void) [static] Internal method called upon initialization of the library (from SoDB::init()) to set up the type system. Reimplemented from SoMField. void SoMFVec3d::setValues (intstart, intnumarg, const doublexyz[][3]) Set num vector array elements from the xyz array, reading from index 0 in the given double-triplet vector array and storing values from index start in this SoMFVec3d's array. If start + num is larger than the current number of elements in the SoMFVec3d field, this method will automatically expand the field to accommodate all given double-vector element values. void SoMFVec3d::set1Value (intidx, doublex, doubley, doublez) Set the vector at idx. void SoMFVec3d::set1Value (intidx, const doublexyz[3]) Set the vector at idx. void SoMFVec3d::setValue (doublex, doubley, doublez) Set this field to contain a single vector with the given element values. void SoMFVec3d::setValue (const doublexyz[3]) Set this field to contain a single vector with the given element values. Author Generated automatically by Doxygen for Coin from the source code. Version 3.1.3 Wed May 23 2012 SoMFVec3d(3)
All times are GMT -4. The time now is 03:42 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy