Sponsored Content
Top Forums Shell Programming and Scripting Change file content based on data Post 302446198 by ranjithpr on Wednesday 18th of August 2010 03:56:21 AM
Old 08-18-2010
Are you looking for something like this.

Code:
$ cat 1.txt
Position 1:10 -> CN0001N -
Position 252:255 -> 0292

Position 1:10 -> CN0001N -
Position 252:255 -> 7810

Position 1:10 -> CN0002N -
Position 252:255 -> 0111

Position 1:10 -> CN0001N -
Position 252:255 -> 0292

Code:
awk -F "->" '{
       if($1 == "Position 1:10 ")
       {
          line1=$0;
          getline;
          if($2==0292 || $2==0379 || $2==1038 || $2==7810|| $2==7811|| $2==7812|| $2==7842|| $2==7843)
             line1="Position 1:10 -> CNQCSHN -";
          print line1;
          print;
       }
       else print;
    }' 1.txt

Code:
Output:
Position 1:10 -> CNQCSHN -
Position 252:255 -> 0292

Position 1:10 -> CNQCSHN -
Position 252:255 -> 7810

Position 1:10 -> CN0002N -
Position 252:255 -> 0111

Position 1:10 -> CNQCSHN -
Position 252:255 -> 0292

 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Need help to change the content for remote located file

Hi All, I have one file that sits on 4 diffrent servers, those servers are diffrent region based and they are authentication protected and that file has a diff port numbers, so when run the script it must ask my login details,region of server and port no for that file once it took from me... (1 Reply)
Discussion started by: tmarjuna
1 Replies

2. Shell Programming and Scripting

How to change a file's content by row?

Greetings. So the question is basically the same as it's in the title. I'd like to write a program that changes a file by rows. So to clarify it. (i know i shouldn't use code,/code here but i would like to separate it) So for example a text file looks like something like this: Happy... (5 Replies)
Discussion started by: buddhist
5 Replies

3. Shell Programming and Scripting

Scan and change file data content problem

Input file >Read_1 XXXXXXXXXXSDFXXXXXDS (condition 1: After the last "X" per line, if the distance is less than or equal to 3 letter, replace those not "X" letter with "X") TREXXXXXXXSDFXXXXXDS (condition 2: Before the first "X" per line, if the distance is less than or equal to 3 letter,... (12 Replies)
Discussion started by: patrick87
12 Replies

4. Shell Programming and Scripting

Execution Problems with scan and change file data content

Input file >Read_1 XXXXXXXXXXSDFXXXXXDS ASDRXXXXXTGAGTXXXXXT TGTGATXXXXXAXXXXGXXA . . Desired output file >Read_1 XXXXXXXXXXXXXXXXXXDS ASDRXXXXXTGAGTXXXXXT TGTGATXXXXXXXXXXXXXA . . (5 Replies)
Discussion started by: patrick87
5 Replies

5. Linux

when SCP, does file content change?

Good day to you all, Just want to check here, i know when scping a file, size might change due to space issue. it might sound silly, but does file content get change too? if so, what kind of situation that might be? (1 Reply)
Discussion started by: ahtat99
1 Replies

6. Shell Programming and Scripting

Split the file based on the content

Arun kumar something somehting Enterting in to the line . . . . Some text text Finshing the sentence Some other text . . . . Again something somehting Enterting in to the line . . . . . . Again text text Finshing the sentence (6 Replies)
Discussion started by: arukuku
6 Replies

7. Shell Programming and Scripting

Help with analysis data based on particular column content

Input file: Total_counts 1306726155 100% Number_of_count_true 855020282 Number_of_count_true_1 160014283 Number_of_count_true_2 44002825 Number_of_count_true_3 18098424 Number_of_count_true_4 24693745 Number_of_count_false 115421870 Number_of_count_true 51048447 Total_number_of_false ... (2 Replies)
Discussion started by: perl_beginner
2 Replies

8. Shell Programming and Scripting

Help with data rearrangement based on share same content

Input file data_2 USA data_2 JAPAN data_3 UK data_4 Brazil data_5 Singapore data_5 Indo data_5 Thailand data_6 China Desired output file data_2 USA/JAPAN data_3 UK data_4 Brazil data_5 Singapore/Indo/Thailand data_6 China I would like to merge all data content that share same... (2 Replies)
Discussion started by: perl_beginner
2 Replies

9. Shell Programming and Scripting

Change a file content format using awk

Hi, i have a file input.txt Continent North America Country USA Capital Washington D.C. Country Canada Capital Ottawa Continent South America Country Argentina Capital Buenos Aires Country Brazil Capital Brasília Coutry Colombia Capital Bogotá and i want to get an output.txt ... (3 Replies)
Discussion started by: fastlane3000
3 Replies

10. Shell Programming and Scripting

Script to change the file content using some conditions

Hello, I would like to change the content of the file that has few blocks starts with 10 and ends with ";" File1.txt 10 bonuses D 20 MATCHED 30 UPD COL 40 (SOL=30) 20 NOT MATCHED 30 INS COL 40 (SOL=30) ; 10 bonuses D 20 MATCHED 30 UPD COL 40... (5 Replies)
Discussion started by: Mannu2525
5 Replies
XmDragIcon(3)							  LessTif Manuals						     XmDragIcon(3)

NAME
XmDragIcon - Motif-compatible widget for action icons during drag'n'drop SYNOPSIS
#include <Xm/DragIcon.h> XmDragIcon XmCreateDragIcon DESCRIPTION
XmDragIcon X RESOURCES
Name Class Type Default Access ------------------------------------------------------------------ XmNdepth XmCDepth Int 1 CSG XmNwidth XmCWidth Dimension NULL CSG XmNheight XmCHeight Dimension NULL CSG XmNhotX XmCHot Position NULL CSG XmNhotY XmCHot Position NULL CSG XmNmask XmCPixmap Bitmap NULL CSG XmNpixmap XmCPixmap Bitmap NULL CSG XmNoffsetX XmCOffset Position NULL CSG XmNoffsetY XmCOffset Position NULL CSG XmNattachment XmCAttachment IconAttachment NULL CSG XmNdepth XmNwidth XmNheight XmNhotX XmNhotY XmNmask XmNpixmap XmNoffsetX XmNoffsetY XmNattachment CLASS HIERARCHY
Object(3) XmDragIcon(3) CALLBACKS
CONVENIENCE FUNCTIONS
SEE ALSO
LessTif Project April 1998 XmDragIcon(3)
All times are GMT -4. The time now is 02:52 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy