i am writing a cron job. in this script i need to delete some line which is match with some pattern.
following code i written for deletion
this command is working fine but the problem is that after this deletion every time will give the rights to myfile.txt.
is there any other way to perform this deletion without help of any temp file
one more point i need to delete lines permanetly from file.
thanx in advance
Last edited by Franklin52; 02-03-2011 at 03:24 AM..
Reason: Please use code tags, thank you
Hi,
Could some one help me to get rid of visually blank lines from a file using shell or awk or sed (on Solaris machine)?
When I use grep grep -v ^$ inputfile >outputfile it removes some blank lines.. but it seems some tab plus space balnk lines remains.
thaen I used "grep -v '^]*$' ... (1 Reply)
hello... I have a file with a list of filepaths in it, like so:
delMe.txt (files to be deleted)
./root/index.php
./root/language/se/home.inc.php
./root/language/pl/home.inc.php
Now here's what I'm trying to do. I want any lines in the above file (delMe.txt) to be deleted out of the... (3 Replies)
Input:
a
b
b
c
d
d
I need:
a
c
I know how to get this (the lines that have duplicates) :
b
d
sort file | uniq -d
But i need opossite of this. I have searched the forum and other places as well, but have found solution for everything except this variant of the problem. (3 Replies)
Hi All,
I have a very huge file (4GB) which has duplicate lines. I want to delete duplicate lines leaving unique lines. Sort, uniq, awk '!x++' are not working as its running out of buffer space.
I dont know if this works : I want to read each line of the File in a For Loop, and want to... (16 Replies)
How to remove x lines form top and y lines form bottom.
This works, but like awk only cat file | head -n-y | awk 'NR>(x-1)'
so remove last 3 lines and 5 firstcat file | head -n-3 | awk 'NR>4' (5 Replies)
Hello,
I have file of more than 10000 lines.
I want to delete 40 lines after every 20 lines.
e.g from a huge file, i want to delete line no from 34 - 74, then 94 - 134 etc and so on.
Please let me know how i can do it.
Best regards, (11 Replies)