Sponsored Content
Full Discussion: Edit locations in a file
Top Forums UNIX for Dummies Questions & Answers Edit locations in a file Post 302891609 by siya@ on Thursday 6th of March 2014 06:09:46 PM
Old 03-06-2014
Edit locations in a file

Hi ,
I have a file which looks like this

Code:
source1     LEN        predictive    392879  394347  0.955489        +       .       Name=sa000003.1;ID=sa000003;Alias=sa121751.1;
source1     LEN       descriptive_1   391082  392878  .       .       .       Parent=sa000003.1;supp_id=.1805.1;

source1      LEN        predictive    408863  416522  0.999853        -       .       Name=sa000004.1;ID=sa000004;
source1      LEN        descriptive_1   416523  416853  .       .       .       Parent=sa000004.1;supp_id=14.112.2;

source1     LEN        predictive    347320  348798  0.485927        -       .       Name=sa000006.1;ID=sa000006;Alias=sa121750.;
source1      LEN         descriptive_1   348799  351449  .       .       .       Parent=sa000006.1;supp_id=1800.1;
source1      LEN         descriptive_3   347154  347319  .       .       .       Parent=sa000006.1;supp_id=1800.1;

Basically ,I need to change the start and end locations of predictive statement in accordance to descriptive_1 and 3


if line containing PREDICTIVE statement has start locations > descriptive_1 or descriptive_3 start location then i have to replace start location of predictive by descriptive_1 or or descriptive_3
if line containing PREDICTIVE statement has end location < descriptive end .then replace end location of predictive by descriptive1 or descriptive_3
Basically all descriptive locations should fall under all predictive start and end locations.
Another thing to note is thedescriptive statements have same parent as the predictive name)
The end result should look like :

Code:
source1     LEN        predictive    391082  394347  0.955489        +       .       Name=sa000003.1;ID=sa000003;Alias=sa121751.1;
source1     LEN       descriptive_1   391082  392878  .       .       .       Parent=sa000003.1;supp_id=.1805.1;

source1      LEN        predictive    408863  4168533  0.999853        -       .       Name=sa000004.1;ID=sa000004;
source1      LEN        descriptive_1   416523  416853  .       .       .       Parent=sa000004.1;supp_id=14.112.2;

source1     LEN        predictive    347154  351449  0.485927        -       .       Name=sa000006.1;ID=sa000006;Alias=sa121750.;
source1      LEN         descriptive_1   348799  351449  .       .       .       Parent=sa000006.1;supp_id=1800.1;
source1      LEN         descriptive_3   347154  348319  .       .       .       Parent=sa000006.1;supp_id=1800.1;

Smilie

Thanks

Last edited by siya@; 03-06-2014 at 07:17 PM..
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Standard Out to Two Locations

Is it possible to redirect standard output to two locations? Unfortunately, I need to redirect it to two different files. Or if there might be any utilities that can do it. I'm suspecting not as it's all pipes and filters, but thought I'd ask. (2 Replies)
Discussion started by: GaryRudolph
2 Replies

2. Solaris

file locations...

Hi Guys, There was a post that I saw here a while ago regarding file system layout and what to put where, which I am unable to find now.. A user here posted a man page that list what each partition should have in it and what it is used for and were you should install custom packages. ie:... (1 Reply)
Discussion started by: Tornado
1 Replies

3. Shell Programming and Scripting

Script to Edit the file content and create new file

I have a requirement, which is as follows *. Folder contains list of xmls. Script has to create new xml files by copying the existing one and renaming it by appending "_pre.xml" at the end. *. Each file has multiple <Name>fileName</Name> entry. The script has to find the first occurance of... (1 Reply)
Discussion started by: sudesh.ach
1 Replies

4. Shell Programming and Scripting

Sending a file to 24 Server locations parallely

Hi All, I have to send a processed file to 24 different server locations. I feel, if this job can be done parallel in the background - Time will come down. I found the script to FTP the file for a single server location through past Unix posts as below: #!/usr/bin/ksh ftp -v -n... (16 Replies)
Discussion started by: vsmeruga
16 Replies

5. UNIX for Advanced & Expert Users

Insert Delimiter at fixed locations in a flat file

Hi Can somebody help me with solution for this PLEASE? I have a flat file and need to insert delimiters at fixed positions in all the lines so that I can easily convert into EXCEL with columns defined as per their width. For Example Here is the file { kkjhdhal sdfewss sdtereetyw... (7 Replies)
Discussion started by: jd_mca
7 Replies

6. Shell Programming and Scripting

Program to insert Delimiters at fixed locations in a file, Can you please Debug it for me??

Can someone please help?I have a file - fixed.txt----------------------------AABBBBCCCCCCDDDEEFFFFGGGGGGHHHIIJJJJKKKKKKLLL----------------------------To insert delimiters at fixed lengths of 2, 4, 6, 3, I created a file text1.txt as-------------------2463----------------------and trying to execute... (10 Replies)
Discussion started by: jd_mca
10 Replies

7. Shell Programming and Scripting

Inserting commas into file at set locations...

Hey everyone. What would be the best method to insert commas (or comma-quotes) into a file at set locations. Every line in the file looks like this: 1234567890123456 123456BIGAUDIODYNAMITE33 123.12 123456 12345678901234MARK E WILLIAMS 123456 The comma's should... (6 Replies)
Discussion started by: Astrocloud
6 Replies

8. UNIX for Advanced & Expert Users

Edit file

Hi All, I have file with 200K Records and each line with 400 character. I need to edit the some part of the file. For example, i need to edit character from 115 to 125, 135to 145 and 344 to 361 Can you please anyone help me to do this? Regards, (1 Reply)
Discussion started by: balasubramani04
1 Replies

9. Shell Programming and Scripting

Writing to two locations at once

I have a backup script that runs on CRON that I developed about 5 years ago. It has always worked perfectly but a recent firmware update on my QNAP TS 259 has seem to break the large file move/copy capability amongst the ESATA drives. I would like to just change my backhup.sh so that writes... (3 Replies)
Discussion started by: mackconsult
3 Replies
IP-NTABLE(8)							       Linux							      IP-NTABLE(8)

NAME
ip-ntable - neighbour table configuration SYNOPSIS
ip [ OPTIONS ] address { COMMAND | help } ip ntable change name NAME [ dev DEV ] PARMS PARMS := { thresh1 VAL | thresh2 VAL | thresh3 VAL | gc_int MSEC | base_reachable MSEC | retrans MSEC | gc_stale MSEC | delay_probe MSEC | queue LEN | app_probs VAL | ucast_probes VAL | mcast_probes VAL | anycast_delay MSEC | proxy_delay MSEC | proxy_queue LEN | locktime MSEC } ip ntable show [ dev DEV ] [ name NAME ] DESCRIPTION
ip ntable controls the parameters for the neighbour tables. ip ntable show - list the ip neighbour tables This commands displays neighbour table parameters and statistics. dev DEV only list the table attached to this device. name NAME only lists the table with the given name. ip ntable change - modify table parameter This command allows modifying table parameters such as timers and queue lengths. name NAME the name of the table to modify. dev DEV the name of the device to modify the table values. EXAMPLES
ip ntable show dev eth0 Shows the neighbour table (IPv4 ARP and IPv6 ndisc) parameters on device eth0. ip ntable change name arp_cache queue 8 dev eth0 Changes the number of packets queued while address is being resolved from the default value (3) to 8 packets. SEE ALSO
ip(8) AUTHOR
Manpage by Stephen Hemminger iproute2 20 Dec 2011 IP-NTABLE(8)
All times are GMT -4. The time now is 08:31 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy