Search Results

Search: Posts Made By: TY718
Forum: Programming 04-14-2015
1,808
Posted By TY718
PYTHON COPY Contents of file1 into a specific entry in file2
file1
cat
dog
fish

file2
This is a bunch of lines
<!-- INSERT ANIMALS HERE -->
horse
cheetah


post results
file2
This is a bunch of lines
<!-- INSERT ANIMALS HERE -->
cat
dog...
1,040
Posted By TY718
I tried Python but I am not well versed. I...
I tried Python but I am not well versed. I understand Sed to replace and Grep for pattern match. dont know enough to put two and two together.
1,040
Posted By TY718
Obtain pattern from file; Append 1st Match
Not clear how to do so. Looking to append the 1st match of said pattern with 'OK TO REMOVE'

file containing patter
File1.txt
RMS_QUANTITY_RT
SMS_QUANTITY_RT

file to search
File2.txt
<!--...
1,129
Posted By TY718
Match and Append Based on file contexts
Not Sure how to do this. Some combo of awk and sed perhaps. If String in File1 match String in file2 then append file2

File1.txt
BullTerrier
Boxer
Bulldog

File2.txt


<Defined...
2,213
Posted By TY718
is this a better explanation? a. Match...
is this a better explanation?


a. Match text between two patterns(including pattern)

b. Move match out to new file

c. Replace text in original file with comment (i.e. ##insert data here##)...
2,213
Posted By TY718
this does not seem to work
this does not seem to work
2,213
Posted By TY718
that is interested and I will certainly test....
that is interested and I will certainly test. Follow up question if I may. What if I would like to put a place holder while the text is removed from the file. Perhaps a comment like


###...
2,213
Posted By TY718
Awk; pattern match, remove and re write
the following pattern match works correctly for me

awk '/name="Fruits"/{f=1;next} /"name=Vegetables"/{f=0} f' filename


This works well for me. Id like to temporarily move the match out of the...
Showing results 1 to 8 of 8

 
All times are GMT -4. The time now is 09:59 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy