Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Replace specific positions in a file Post 303031528 by Diver181 on Friday 1st of March 2019 02:23:29 PM
Old 03-01-2019
thank you. it worked.

--- Post updated at 07:23 PM ---

Sure. Thank you. Will do.
By the way In my example above both numbers have trailing spaces of 2 characters which makes each of length 10.
Starting position, for both lines, is 4 and ending position is 13 (includes 2 spaces at the end).
This User Gave Thanks to Diver181 For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Replace 9-16 positions of a text file.

Hi i am having text file like this 40000201040005200213072009000000700000050744820906904421 40069300240005200713072009000000067400098543630000920442 i want to replace 9-16 positions of my txt file...by 1234567...in a single line command i.e 0400052....should be replaced by... (2 Replies)
Discussion started by: suryanarayana
2 Replies

2. Shell Programming and Scripting

Need specific byte positions of a file

Hello , I need to extract data from specific byte positions of a file. I have tried the below command awk ' { printf "%s", substr($0, 642363,642369}' filename to extract data between byte positions 642363 and 642369 . However I did not get the expected result. I am new to awk... (6 Replies)
Discussion started by: rmv
6 Replies

3. Shell Programming and Scripting

awk script replace positions if certain positions equal prescribed value

I am attempting to replace positions 44-46 with YYY if positions 48-50 = XXX. awk -F "" '{if (substr($0,48,3)=="XXX") $44="YYY"}1' OFS="" $filename > $tempfile But this is not working, 44-46 is still spaces in my tempfile instead of YYY. Any suggestions would be greatly appreciated. (9 Replies)
Discussion started by: halplessProblem
9 Replies

4. Shell Programming and Scripting

Replace a string within a file.. with help of positions

I have a huge file with lot of rows... with each row around 400 characters.. with spaces as well.. (e.g) Line1: "AC254600606 USDMI000001Anom01130073981 0000000000000.002005040720991231 ... (13 Replies)
Discussion started by: gopeezere
13 Replies

5. Shell Programming and Scripting

output strings to specific positions in a file

Been searching for about 3 hours for similar functionality that I can get examples of how to output text from variables into certain locations in a file. I would like to incorporate this into a script. I have not been able to find a command example that does it all in one method. I find part of... (1 Reply)
Discussion started by: bennu_500
1 Replies

6. Shell Programming and Scripting

Count specific characters at specific column positions

Hi all, I need help. I have an input text file (input.txt) like this: 21 GTGCAACACCGTCTTGAGAGG 50 21 GACCGAGACAGAATGAAAATC 73 21 CGGGTCTGTAGTAGCAAACGC 108 21 CGAAAAATGAACCCCTTTATC 220 21 CGTGATCCTGTTGAAGGGTCG 259 Now I need to count A/T/G/C numbers at each character location in column... (2 Replies)
Discussion started by: thienxho
2 Replies

7. Shell Programming and Scripting

sed to replace specific positions on line with file contents

Hi, I am trying to use an awk command to replace specific character positions on a line beginning with 80 with contents of another file. The line beginning with 80 in file1 is as follows: I want to replace the 000000000178800 (positions 34 - 49) on this file with the contents of... (2 Replies)
Discussion started by: nwalsh88
2 Replies

8. UNIX for Dummies Questions & Answers

Replace alphabets from certain positions

Hi all, I have column 2 full of values like HIVE4A-56 and HIVE4-56. I want to convert all values like HIVE4A-56 to HIVE4-56. So basically I want to delete all single alphabets before the '-' which is always preceded by a number. Values already in the desired format should remain unchanged... (4 Replies)
Discussion started by: ames1983
4 Replies

9. Shell Programming and Scripting

Filter lines based on values at specific positions

hi. I have a Fixed Length text file as input where the character positions 4-5(two character positions starting from 4th position) indicates the LOB indicator. The file structure is something like below: 10126Apple DrinkOmaha 10231Milkshake New Jersey 103 Billabong Illinois ... (6 Replies)
Discussion started by: kumarjt
6 Replies

10. Shell Programming and Scripting

Search and replace specific positions of specific lines

Hi, I have a file with hundreds of lines. I want to search for particular lines starting with 4000, search and replace the 137-139 position characters; which will be '000', with '036'. Can all of this be done without opening a temp file and then moving that temp file to the original file name. ... (7 Replies)
Discussion started by: dsid
7 Replies
IPC::SysV(3pm)						 Perl Programmers Reference Guide					    IPC::SysV(3pm)

NAME
IPC::SysV - System V IPC constants and system calls SYNOPSIS
use IPC::SysV qw(IPC_STAT IPC_PRIVATE); DESCRIPTION
"IPC::SysV" defines and conditionally exports all the constants defined in your system include files which are needed by the SysV IPC calls. Common ones include IPC_CREATE IPC_EXCL IPC_NOWAIT IPC_PRIVATE IPC_RMID IPC_SET IPC_STAT GETVAL SETVAL GETPID GETNCNT GETZCNT GETALL SETALL SEM_A SEM_R SEM_UNDO SHM_RDONLY SHM_RND SHMLBA and auxiliary ones S_IRUSR S_IWUSR S_IRWXU S_IRGRP S_IWGRP S_IRWXG S_IROTH S_IWOTH S_IRWXO but your system might have more. ftok( PATH ) ftok( PATH, ID ) Return a key based on PATH and ID, which can be used as a key for "msgget", "semget" and "shmget". See ftok. If ID is omitted, it defaults to 1. If a single character is given for ID, the numeric value of that character is used. shmat( ID, ADDR, FLAG ) Attach the shared memory segment identified by ID to the address space of the calling process. See shmat. ADDR should be "undef" unless you really know what you're doing. shmdt( ADDR ) Detach the shared memory segment located at the address specified by ADDR from the address space of the calling process. See shmdt. memread( ADDR, VAR, POS, SIZE ) Reads SIZE bytes from a memory segment at ADDR starting at position POS. VAR must be a variable that will hold the data read. Returns true if successful, or false if there is an error. memread() taints the variable. memwrite( ADDR, STRING, POS, SIZE ) Writes SIZE bytes from STRING to a memory segment at ADDR starting at position POS. If STRING is too long, only SIZE bytes are used; if STRING is too short, nulls are written to fill out SIZE bytes. Returns true if successful, or false if there is an error. SEE ALSO
IPC::Msg, IPC::Semaphore, IPC::SharedMem, ftok, shmat, shmdt AUTHORS
Graham Barr <gbarr@pobox.com>, Jarkko Hietaniemi <jhi@iki.fi>, Marcus Holland-Moritz <mhx@cpan.org> COPYRIGHT
Version 2.x, Copyright (C) 2007-2010, Marcus Holland-Moritz. Version 1.x, Copyright (c) 1997, Graham Barr. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.18.2 2014-01-06 IPC::SysV(3pm)
All times are GMT -4. The time now is 02:20 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy