Sponsored Content
Top Forums Shell Programming and Scripting search in finding position of a string in avariable Post 302165778 by ghostdog74 on Friday 8th of February 2008 09:58:34 PM
Old 02-08-2008
if you can use Python
Code:
#!/bin/sh
python << EOF
a="This is Example Example1 xxx yyy Example"
print [n for n,i in enumerate(a.split()) if "Example" in i]
EOF

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Print lines with search string at specific position

Hi Folks, I have a file with all fields defined by byte position, but any field can be empty so I cannot print lines based on a search of specific columns. I need to print all lines of this file where the string of two characters at byte position 100-101 contains the number 27. Any ideas? ... (4 Replies)
Discussion started by: HealthyGuy
4 Replies

2. Shell Programming and Scripting

how to find a position and print some string in the next and same position

I need a script for... how to find a position of column data and print some string in the next line and same position position should find based on *HEADER8* in text for ex: ord123 abs 123 987HEADER89 test234 ord124 abc 124 987HEADER88 test235 ... (1 Reply)
Discussion started by: naveenkcl
1 Replies

3. Shell Programming and Scripting

Search for a string and replace the searched string in the same position

Hi All, My requisite is to search for the string "0108"(which is the year and has come in the wrong year format) in a particular column say 4th column in a tab delimited file and then replace it with 2008(the correct year format) in the same position where 0108 was found..The issue is the last... (15 Replies)
Discussion started by: ganesh_248
15 Replies

4. Shell Programming and Scripting

search a line and insert string into specific at position

Hi, guys. I have one question: How can I search for a line with certain string in it and then insert a string into this line? For example: There is a file called shadow, the contents of it are below: ************************** ... yuanz:VIRADxMsadfDF/Q:0:0:50:7:::... (9 Replies)
Discussion started by: daikeyang
9 Replies

5. UNIX for Dummies Questions & Answers

Search for a string and replace the searched string in the same position in samefile

Hi All, My requisite is to search for the string "0108"(which is the year and has come in the wrong year format) in a particular column say 4th column in a tab delimited file and then replace it with 2008(the correct year format) in the same position where 0108 was found in the same file..The... (27 Replies)
Discussion started by: ganesh_248
27 Replies

6. UNIX for Dummies Questions & Answers

Search a string in the file and then replace another string after that position

Hi I am looking for a particular string in a file.If the string exists, then I want to replace another string with some other text.Once replaced, search for the same text after that character position in the file. :wall: E.g: Actual File content: Hello Name: Nitin Raj Welcome to Unix... (4 Replies)
Discussion started by: dashing201
4 Replies

7. Shell Programming and Scripting

Search string position in a line

WeeksD1|$26.52|$26.52|03/02/2013|12.48|D1|1.09|0|0|0|0|0|.95|0|0|0|0|0|0|0|0|0|0|0|0|0|0||$0.00|$0.00||0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0||$0.00|$0.00||0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0||$0.00|$0.00||0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|$0.00|$0.00|$0.00|$0.00|$0.00|$0.00|$... (3 Replies)
Discussion started by: gavemani
3 Replies

8. Shell Programming and Scripting

Search a string in a text file and add another string at the particular position of a line

I am having a text file which is having more than 200 lines. EX: 001010122 12000 BIB 12000 11200 1200003 001010122 2000 AND 12000 11200 1200003 001010122 12000 KVB 12000 11200 1200003 In the above file i want to search for string KVB and add/replace... (1 Reply)
Discussion started by: suryanarayana
1 Replies

9. Shell Programming and Scripting

Search string at a particular position in a file

Hi, i have a text file as : abc 0 1 Pass hjk 1 1 Pass bhk 0 0 Fail jjh 8 2 Pass nkji 0 1 Pass Now I want to check that if 1st column is jjh , then , store the value of 3rd string of that line in a variable. Hence, 2... (8 Replies)
Discussion started by: Anamika08
8 Replies

10. Shell Programming and Scripting

Search for a string at a particular position and replace with blank based on position

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
XmTextFieldInsert(library call) 										   XmTextFieldInsert(library call)

NAME
XmTextFieldInsert -- A TextField function that inserts a character string into a text string SYNOPSIS
#include <Xm/TextF.h> void XmTextFieldInsert( Widget widget, XmTextPosition position, char * value); DESCRIPTION
XmTextFieldInsert inserts a character string into the text string in the TextField widget. The character positions begin at 0 (zero) and are numbered sequentially from the beginning of the text. For example, to insert a string after the fourth character, the position parame- ter 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. If the XmNcursorPosition resource is greater than or is the same value as position, the XmNmotionVerifyCallback is called. widget Specifies the TextField widget ID position Specifies the position in the text string where the character string is to be inserted 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) and XmTextFieldInsertWcs(3). XmTextFieldInsert(library call)
All times are GMT -4. The time now is 10:28 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy