04-13-2011
Search and Replace
I am trying to search and replace using two different files with strict search rules.
One file contain some data and the other file contain some numbers as shown below.
DataFile.txt
HTML Code:
>L1_T1
text data...
text data..
>L1_T1
text data...
text data..
>L1_T1
text data...
text data..
.....
.....
>L1_T2
text data...
text data..
>L1_T2
text data...
text data..
...
... upto
>L7_T8
text data...
text data..
>L7_T8
text data...
text data..
data header ranges from L1_T1 .. L1_T8 .. upto L7_T8 (56 headers altogether)
NumberFile.txt
HTML Code:
1
3
4
7
8
75
86
...
...
4025
4030
4032
I want to replace the headers(L*_T*) of DataFile using the numbers from the NumberFile. However, the condition is each header has a particular range to take the numbers and one number can't be used twice. For Example:
L1_T1 can take those available numbers within the range 1 - 72
L1_T2 can take those available numbers within the range 73 - 144
L1_T3 can take those available numbers within the range 144 - 216
....
L1_T8 can take those available numbers within the range 505 - 576
....
...
L7_T8 can take those available numbers within the range 3961 - 4032
(Increment of 72 for each increasing Header)
Example Output for the above data can be:
HTML Code:
>1
text data...
text data..
>3
text data...
text data..
>7
text data...
text data..
.....
.....
>75
text data...
text data..
>86
text data...
text data..
...
...
>4030
text data...
text data..
>4032
text data...
text data..
Thanks for any help.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
hi all,
the problem is like this...... i setup a file (Env.txt) which handles all the values.
NAME1=xxxxxx, where xxxxx is the value
NAME2=xxxxxx
GGGGG=uusufu
I have 6 files, where i will append the values from env.txt. These files has no specific format. all i want is to append the... (1 Reply)
Discussion started by: tungaw2004
1 Replies
2. Shell Programming and Scripting
Hi All,
I have a file that I need to be able to find a pattern match on a line, search that line for a text pattern, and replace that text.
An example of 4 lines in my file is:
1. MatchText_randomNumberOfText moreData ReplaceMe moreData
2. MatchText_randomNumberOfText moreData moreData... (4 Replies)
Discussion started by: Crypto
4 Replies
3. Shell Programming and Scripting
I have a script which has several occurences of statement like
command: $UCMDPATH/xyz abc
I would like to replace the entire line starting from $UCMDPATH with the ls -ltr command
eg:
Prior to change::
command: $UCMDPATH/xyz abc
After change:
command: ls -ltr
Is there a way to do... (12 Replies)
Discussion started by: jobbyjoseph
12 Replies
4. 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
5. Shell Programming and Scripting
Hi,
I want to searcha nd replace a string in file. I am using VI I tried d comm
:s/search_string/replacement_string/g
but it is giving me " string not found" i know for sure the search_string is there in file.
please help me how to do this
thanks,
Firestar (5 Replies)
Discussion started by: firestar
5 Replies
6. Shell Programming and Scripting
Hi!!!
I have following xml file with 3 sections.
aaa1bbb-ccc
default
aaa1bbbdd
default
0 11 23 * *
aaa2bbb-ccc
default
aaa2bbbdd
default
0 11 23 * *
aaa3bbb-ccc
default
aaa3bbbdd
default
0 15 23 * * (15 Replies)
Discussion started by: tdev457
15 Replies
7. Shell Programming and Scripting
Dear All,
i want to search particular string and want to replance next line value.
following is the test file.
search string is
tmp,???
,10:1 "???" may contain any 3 character it should remain the same and next line replace with ,10:50
tmp,123 --- if match tmp,??? then... (3 Replies)
Discussion started by: arvindng
3 Replies
8. UNIX for Dummies Questions & Answers
Hi all,
I am editing a config file in vi that has a / on it.
At the moment, search and replace looks alright as am able to use a # as a temporary separator, i.e. :,$s#/u01/app#/u02/app#g
For doing a search, I have to escape the / do. So if I want to search for /u01/app, I am having to do... (2 Replies)
Discussion started by: newbie_01
2 Replies
9. Shell Programming and Scripting
Hi,
I need help with search and replace for the following string using vi ..
if ];then
to
if ];then
can this be done in one search and replace or need multiple ?
Thanks (3 Replies)
Discussion started by: talashil
3 Replies
10. Shell Programming and Scripting
Hi Team,
I am new to unix, please help me in this.
I have a file named properties.
The content of the file is :
##Mobile props
east.url=https://qa.east.corp.com/prop/end
west.url=https://qa.west.corp.com/prop/end
south.url=https://qa.south.corp.com/prop/end... (2 Replies)
Discussion started by: tolearn
2 Replies
LEARN ABOUT DEBIAN
pod::pom::view::html
Pod::POM::View::HTML(3pm) User Contributed Perl Documentation Pod::POM::View::HTML(3pm)
NAME
Pod::POM::View::HTML - create HTML views of POM objects
DESCRIPTION
HTML view of a Pod Object Model.
METHODS
"view($self, $type, $item)"
"view_pod($self, $pod)"
"view_head1($self, $head1)"
"view_head2($self, $head2)"
"view_head3($self, $head3)"
"view_head4($self, $head4)"
"view_over($self, $over)"
"view_item($self, $item)"
"view_for($self, $for)"
"view_begin($self, $begin)"
"view_textblock($self, $textblock)"
"view_verbatim($self, $verbatim)"
"view_meta($self, $meta)"
"view_seq_bold($self, $text)"
Returns the text of a "B<>" sequence enclosed in a "<b<>" element.
"view_seq_italic($self, $text)"
Returns the text of a "I<>" sequence enclosed in a "<i<>" element.
"view_seq_code($self, $text)"
Returns the text of a "C<>" sequence enclosed in a "<code<>" element.
"view_seq_file($self, $text)"
"view_seq_entity($self, $text)"
"view_seq_index($self, $text)"
Returns an empty string. Index sequences are suppressed in HTML view.
"view_seq_link($self, $text)"
AUTHOR
Andy Wardley <abw@kfs.org>
COPYRIGHT AND LICENSE
Copyright (C) 2000 Andy Wardley. All Rights Reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
perl v5.10.1 2010-04-03 Pod::POM::View::HTML(3pm)