08-13-2014
Hm... If all you want to do is duplicate the contents of OLDFILE, why not just cp OLDFILE ... ? Your example is too short to show the entire face of the problem, I think.
[edit] I see the problem. You didn't post any portion of DeckToChange, leaving it a complete mystery, and giving us absolutely nothing to test with.
Also, this line-matching approach in general troubles me. How sure are you that there's never going to be any identical lines, at all ,ever? If that ever happens, you could replace many lines you didn't intend to.
Last edited by Corona688; 08-13-2014 at 04:50 PM..
This User Gave Thanks to Corona688 For This Post:
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi ,
I have file, which has the below content:
line 100
a
b
c
d
line300
a
s
d
f
s
line200
a
s
d
a (3 Replies)
Discussion started by: little_wonder
3 Replies
2. Shell Programming and Scripting
Does awk have a syntax for a range of numbers or is this the best way?
if ($1 >= 0 && $1 <= 9 ) (7 Replies)
Discussion started by: Arsenalman
7 Replies
3. Shell Programming and Scripting
Hi,
I am trying to locate the occurences of certain pattern like 'Possible network disconnect' in a text file. I can get the actual lines matching the pttern using:
grep -w 'Possible network disconnect' file_name.
But I am more interested in getting the timing of these events which are... (7 Replies)
Discussion started by: sagarparadkar
7 Replies
4. Shell Programming and Scripting
Hi All,
I have a .txt file with some contents as below:
Hi How are you?
# Fine and you?
I want a script file which reads the .txt file and output the lines which does not start with #.
Hi How are you?
Help is highly appreciated.
Please use code tags when posting data and... (5 Replies)
Discussion started by: bghosh
5 Replies
5. Shell Programming and Scripting
Dear Unix Forums,
I am hoping you can help me with a pattern matching problem.
What am I trying to do?
I want to replace multiple lines of a text file (that match a multi-line pattern) with a single line of text. These patterns can span several lines and do not always have the same number of... (10 Replies)
Discussion started by: thefang
10 Replies
6. Shell Programming and Scripting
I have an awk related question that I was hoping you all could help with.
I am given 2 input files named OLDFILE and NEWFILE, and a Master file named MASTERFILE. They can be seen below.
OLDFILE:
a
a
a
a
a
f
g
4
5
7
8
1
2
3 (1 Reply)
Discussion started by: tiktak292
1 Replies
7. Shell Programming and Scripting
Hello
I have a large file1 which has many events like "2014010420" and following lines under each event that start with text . It has this form:
2014010420 num --- --- num ....
NTE num num --- num...
EFA num num --- num ...
LASW num num --- num... (9 Replies)
Discussion started by: phaethon
9 Replies
8. UNIX for Dummies Questions & Answers
Hi all!
Thanks for taking the time to view this!
I want to grep out all lines of a file that starts with pattern 1 but also does not match with the second pattern.
Example:
Drink a soda
Eat a banana
Eat multiple bananas
Drink an apple juice
Eat an apple
Eat multiple apples
I... (8 Replies)
Discussion started by: demmel
8 Replies
9. UNIX for Dummies Questions & Answers
e.g.
File name: File.txt
cat File.txt
Result:
#INBOUND_QUEUE=FAQ1
INBOUND_QUEUE=FAQ2
I want to get the value for one which is not commented out.
Thanks, (3 Replies)
Discussion started by: Tanu
3 Replies
10. UNIX for Beginners Questions & Answers
I have a file with a list of references towards the end and want to apply a grep for some string.
text ....
@unnumbered References
@sp 1
@paragraphindent 0
2017. @strong{Chalenski, D.A.}; Wang, K.; Tatanova, Maria; Lopez,
Jorge L.; Hatchell, P.; Dutta, P.; @strong{Small airgun... (1 Reply)
Discussion started by: kristinu
1 Replies