06-03-2010
Replace strings based on position and length?
Suppose i have a file which contains thousands of records. e.g adjgmptjadmwpgjmwmd i need to replace the string from 3rd to 8th position using awk script in entire file. And also the positions will be passed as parameter.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I need to insert strings "0000 00" at the each line within the file.
The postion is 37 to 42.
ex.
name1 name2 0000 00
nam name 0000 00
The "0000 00" in two lines should be lined up.
I don't know why it's not lined up when I posted it.
Can anyone help? (14 Replies)
Discussion started by: whatisthis
14 Replies
2. Shell Programming and Scripting
Hello,
I really would appreciate some help with a bash script for some string manipulation on an SQL dump:
I'd like to be able to rename "sites/WHATEVER/files" to "sites/SOMETHINGELSE/files" within the sql dump.
This is quite easy with sed:
sed -e... (1 Reply)
Discussion started by: otrotipo
1 Replies
3. Shell Programming and Scripting
Hi All
I am very much in need of help splitting strings based on length in Perl. e.g.,
Input text is :
International NOUN
Corp. NOUN
's POS
Tulsa NOUN
Output I want is :
International I In Int Inte l al nal onal NOUN
Corp. C Co Cor Corp . p. rp. orp. NOUN... (2 Replies)
Discussion started by: my_Perl
2 Replies
4. UNIX for Dummies Questions & Answers
Trying to use sed - but having no luck.
I have a text file - I want to replace whatever character is in position 106, 157 and 237 w/ the string "xxx". Want this change for all lines w/in that text file.
I'm open to using awk or whatever command would be best for replacing characters based... (5 Replies)
Discussion started by: svn
5 Replies
5. UNIX for Dummies Questions & Answers
Hello guys,
should be a very easy questn for you:
I need to delete strings in file1 based on the list of strings in file2.
like file2:
word1_word2_
word3_word5_
word3_word4_
word6_word7_
file1:
word1_word2_otherwords..,word3_word5_others... (7 Replies)
Discussion started by: roussine
7 Replies
6. Shell Programming and Scripting
here is what i want to achieve... consider a file contains below contents. the file size is large about 60mb
cat dump.sql
INSERT INTO `table1` (`id`, `action`, `date`, `descrip`, `lastModified`) VALUES (1,'Change','2011-05-05 00:00:00','Account Updated','2012-02-10... (10 Replies)
Discussion started by: vivek d r
10 Replies
7. Shell Programming and Scripting
Hi gurus,
I am trying to figure out how to extract substring from file line (all lines in file), as specified position and specified legth.
Example input (file lines)
dhaskjdsa dsadhkjsa dhsakjdsad hsadkjh
dsahjdksahdsad sahkjd sahdkjsahd sajkdh adhjsak
I want to extract substring on... (5 Replies)
Discussion started by: ProsteJa
5 Replies
8. UNIX for Dummies Questions & Answers
I have several questions about using awk. I'm hoping someone could lend me a hand. (I'm also hoping that my questions make sense.)
I have a file that contains pipe separated data. Each line has similar data but the number of fields and the field position on each line is variable. ... (3 Replies)
Discussion started by: Cheese64
3 Replies
9. Shell Programming and Scripting
Hi,
I have a file with multiple lines(fixed width dat file). I want to search for '02' in the positions 45-46 and if available, in that lines, I need to replace value in position 359 with blank. As I am new to unix, I am not able to figure out how to do this. Can you please help me to achieve... (9 Replies)
Discussion started by: Pradhikshan
9 Replies
10. UNIX for Beginners Questions & Answers
I am using bash in Fedora 30
From the below lines (ls -l output), how can I print whatever is between the strings 'status_' and '.log'
$ ls -l | grep -i status
-rw-rw-r--. 1 sysadmin sysadmin 378530 Nov 11 21:58 status_vsbm1.log
-rw-rw-r--. 1 sysadmin sysadmin 428776 Nov 11 21:58... (8 Replies)
Discussion started by: kraljic
8 Replies
LEARN ABOUT CENTOS
xmtextfieldreplace
XmTextFieldReplace(library call) XmTextFieldReplace(library call)
NAME
XmTextFieldReplace -- A TextField function that replaces part of a text string
SYNOPSIS
#include <Xm/TextF.h>
void XmTextFieldReplace(
Widget widget,
XmTextPosition from_pos,
XmTextPosition to_pos,
char * value);
DESCRIPTION
XmTextFieldReplace replaces part of the text string in the TextField widget. The character positions begin at 0 (zero) and are numbered
sequentially from the beginning of the text.
An example text replacement would be to replace the second and third characters in the text string. To accomplish this, the parameter
from_pos must be 1 and to_pos must be 3. To insert a string after the fourth character, both parameters, from_pos and to_pos, must be 4.
This routine calls the widget's XmNvalueChangedCallback and verification callbacks, either XmNmodifyVerifyCallback or XmNmodifyVerifyCall-
backWcs, or both. If both verification callback lists are registered, the procedures of the XmNmodifyVerifyCallback list are executed first
and the resulting data is passed to the XmNmodifyVerifyCallbackWcs callbacks. The XmNmotionVerifyCallback is generated if to_pos is less
than or equal to the cursor position and the length of value is not the same as the length of the text being replaced, or if the cursor
position is between from_pos and to_pos, and the distance from the cursor position to from_pos is greater than the length of value.
widget Specifies the TextField widget ID
from_pos Specifies the start position of the text to be replaced
to_pos Specifies the end position of the text to be replaced
value Specifies the character string value to be added to the text widget
For a complete definition of TextField and its associated resources, see XmTextField(3).
RELATED
XmTextField(3). XmTextFieldReplaceWcs(3).
XmTextFieldReplace(library call)