Sponsored Content
Top Forums Shell Programming and Scripting Using sed to replace specific character and specific position Post 302322414 by programmer22 on Wednesday 3rd of June 2009 04:23:51 PM
Old 06-03-2009
Using sed to replace specific character and specific position

I am trying to use sed to replace specific characters at a specific position in the file with a different value... can this be done?

Example:

File:
A0199999123
A0199999124
A0199999125

Need to replace 99999 in positions 3-7 with 88888.

Any help is appreciated.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

using sed to replace a specific string on a specific line number using variables

using sed to replace a specific string on a specific line number using variables this is where i am at grep -v WARNING output | grep -v spawn | grep -v Passphrase | grep -v Authentication | grep -v '/sbin/tfadmin netguard -C'| grep -v 'NETWORK>' >> output.clean grep -n Destination... (2 Replies)
Discussion started by: todd.cutting
2 Replies

2. Shell Programming and Scripting

Insert character in a specific position of a file

Hi, I need to add Pipe (|) at 5th and 18th position of all records a file. How can I do this? I tried to add it at 5th position using the below code. It didnt work. Please help!!! awk '{substr($0,5,1) ~ /|/}{print}' $input_file > $temp_file (1 Reply)
Discussion started by: gpaulose
1 Replies

3. Shell Programming and Scripting

how to replace specific character , if possible using sed

My script is extracting data from SQl session, however sometimes the result contains one or multiple space after/before any numerical value. e,g . "123","1 34","1 3 45", "43 5" How to remove these unwanted spaces..so that I can get the following result : "123","134",1345","435" (1 Reply)
Discussion started by: mady135
1 Replies

4. Shell Programming and Scripting

Sed position specific replace

I'm drawing a blank on how to use sed to replace selectively based on position in the string (vs nth occurence): hello.|there.|how.|are.|you.| I want the period removed in the 3rd item (as defined by the pipe delimiter) if a period is present. So the result in this case would be: ... (2 Replies)
Discussion started by: tiggyboo
2 Replies

5. Shell Programming and Scripting

Using sed to replace a string in a specific position

I asked this before, but my problem got more complicated. Heres what I am trying to do: I'm trying to replace a string at a certain location with another string. Heres the file I'm trying to change: \E I want to replace the escape code at the 3rd line, 2nd column with this escape code... (3 Replies)
Discussion started by: tinman47
3 Replies

6. 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

7. Shell Programming and Scripting

Delete character on specific position

Hi, im still new in unix. i want to ask how to delete character on specific position in line, lets say i want to remove 5 character from position 1000, so characters from position 1000-1005 will be deleted. i found this sed command can delete 4 characters from position 10, but i dont know if... (7 Replies)
Discussion started by: bluesue
7 Replies

8. Linux

Removing a character at specific position in a column

Hi, I have a file like this (about 8 columns in total, this being the 2nd column) gi_49482297_ref_YP_039521.1_ gi_49482297_ref_YP_039521.1_ gi_49482315_ref_YP_039539.1_ gi_49482315_ref_YP_039539.1_I want to remove the _ at the end of the line. And at later stages I would want to replace the... (5 Replies)
Discussion started by: Syeda Sumayya
5 Replies

9. Post Here to Contact Site Administrators and Moderators

Search for a pattern and replace a space at specific position with a Character in File

In file, we have millions of records each of 1000 in length. And at specific position say 800 there is a space, we need to replace it with Character X if the ID in that row starts with 123. So far i have used the below which is replacing space at that position to X but its not checking for... (3 Replies)
Discussion started by: Jagmeet Singh
3 Replies

10. Shell Programming and Scripting

Count specific character of a file in each line and delete this character in a specific position

I will appreciate if you help me here in this script in Solaris Enviroment. Scenario: i have 2 files : 1) /tmp/TRANSACTIONS_DAILY_20180730.txt: 201807300000000004 201807300000000005 201807300000000006 201807300000000007 201807300000000008 2)... (10 Replies)
Discussion started by: teokon90
10 Replies
Bio::Map::OrderedPositionWithDistance(3pm)		User Contributed Perl Documentation		Bio::Map::OrderedPositionWithDistance(3pm)

NAME
Bio::Map::OrderedPositionWithDistance - Abstracts the notion of a member of an ordered list of markers. Each marker is a certain distance from the one in the ordered list before it. SYNOPSIS
use Bio::Map::OrderedPositionWithDistance; # the first marker in the sequence my $position = Bio::Map::OrderedPositionWithDistance->new(-positions => 1, -distance => 22.3 ); # the second marker in the sequence, 15.6 units from the fist one my $position2 = Bio::Map::OrderedPositionWithDistance->new(-positions => 2, -distance => 15.6 ); # the third marker in the sequence, coincidental with the second # marker my $position3 = Bio::Map::OrderedPositionWithDistance->new(-positions => 3, -distance => 0 ); DESCRIPTION
This object is an implementation of the PositionI interface and the Position object handles the specific values of a position. OrderedPositionWithDistance is intended to be slightly more specific then Position but only specific enough for a parser from the MarkerIO subsystem to create and then pass to a client application to bless into the proper type. For an example of how this is intended to work, see the Mapmaker.pm. No units are assumed here - units are handled by context of which Map a position is placed in. Se Bio::Map::Position for additional information. FEEDBACK
Mailing Lists User feedback is an integral part of the evolution of this and other Bioperl modules. Send your comments and suggestions preferably to the Bioperl mailing list. Your participation is much appreciated. bioperl-l@bioperl.org - General discussion http://bioperl.org/wiki/Mailing_lists - About the mailing lists Support Please direct usage questions or support issues to the mailing list: bioperl-l@bioperl.org rather than to the module maintainer directly. Many experienced and reponsive experts will be able look at the problem and quickly address it. Please include a thorough description of the problem with code and data examples if at all possible. Reporting Bugs Report bugs to the Bioperl bug tracking system to help us keep track of the bugs and their resolution. Bug reports can be submitted via the web: https://redmine.open-bio.org/projects/bioperl/ AUTHOR - Chad Matsalla Email bioinformatics1@dieselwurks.com CONTRIBUTORS
Lincoln Stein, lstein@cshl.org Heikki Lehvaslaiho, heikki-at-bioperl-dot-org APPENDIX
The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _ new Title : new Usage : my $obj = Bio::Map::OrderedPositionWithDistance->new(); Function: Builds a new Bio::Map::OrderedPositionWithDistance object Returns : Bio::Map::OrderedPositionWithDistance Args : -positions - Should be a single value representing the order of this marker within the list of markers -distance - The distance this marker is from the marker before it. 0 reflects coincidentality. distance($new_distance) Title : distance($new_distance) Usage : $position->distance(new_distance) _or_ $position->distance() Function: get/set the distance of this position from the previous marker Returns : A scalar representing the current distance for this position. Args : If $new_distance is provided the distance of this Position will be set to $new_distance perl v5.14.2 2012-03-02 Bio::Map::OrderedPositionWithDistance(3pm)
All times are GMT -4. The time now is 11:25 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy