04-08-2008
sed command to delete row
I want to use sed command to delete a matched row with a pattern.
And I also want to delete previous and next row of that row.
Which option can I use with sed ?
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
Tried to look for solution, and found something similar but could not adapt the solution for my needs..
I'm trying to match a pattern (in this case "ProcessType")in a logfile, then delete that line and the 4 following lines.
The logfile looks as follows:
ProcessType: PROCESS_A... (5 Replies)
Discussion started by: Juha
5 Replies
2. Shell Programming and Scripting
Dear Unix users,
I have a (I think simple) question;
I have a file (out.dat) like below,
the file contains some line which include 'LOS' string.
.
LOS 46.5360 91.0220 200708.2515.4900. 5400 64 1100010
.
.
I would like to delete the points in 4th... (4 Replies)
Discussion started by: mgunduz
4 Replies
3. Shell Programming and Scripting
Hi
Is it possible to do the following in a single command
/usr/xpg4/bin/sed -e '/rows selected/d' /aemu/CALLAUTO/callauto.txt > /aemu/CALLAUTO/callautonew.txt
/usr/xpg4/bin/sed -e '/^$/d' /aemu/CALLAUTO/callautonew.txt > /aemu/CALLAUTO/callauto_new.txt
exit (1 Reply)
Discussion started by: aemunathan
1 Replies
4. Shell Programming and Scripting
Can any one help me how the sed delete only first line command (D) works.
sed -f sedcmds File.txt
In this how the sed delete only first line command (D) works to delete the blank lines appearing more than ones leaving only one blank and deleting others blanks.
While doing step by step when... (2 Replies)
Discussion started by: gwgreen1
2 Replies
5. Shell Programming and Scripting
I want to delete a line between selected lines using sed:
e.g. : Between "bus" to "pins", delete lines conaining "signal" word.
Input :
bus
direction
signal new
signal old
pins
signal ok
end
Desired Output:
bus
direction
pins
signal
end (4 Replies)
Discussion started by: nehashine
4 Replies
6. Shell Programming and Scripting
HI,
Im using the below commmand to delete lines having "(" at the start of a line.
sed -e '/^(/d'
But i need a command to delete lines that has only "(" in it and no other strings.
infile -
asdf
asdf
( asdf
(
asd
outfile (1 Reply)
Discussion started by: dvah
1 Replies
7. Shell Programming and Scripting
Hello,
I want to delete all lines with given string in file1 and the string val is dynamic.
Can this be done using sed command.
Sample:
vars="test twinning yellow"
for i in $vars
do
grep $i file1
if
then
echo "Do Nothing"
else
sed `/$i/d` file1
fi
done
Using the above... (5 Replies)
Discussion started by: PrasadAruna
5 Replies
8. Shell Programming and Scripting
I have a large data file that I need to edit. There are lines like,
> <IDNUMBER> (ST000002)
> <SUPPLIER> (ST000002)
> <IDNUMBER> (ST000004)
> <SUPPLIER> (ST000004)
and I need to delete everything after the >, excepting the end of line.
> <IDNUMBER>
> <SUPPLIER>
> <IDNUMBER>
> ... (4 Replies)
Discussion started by: LMHmedchem
4 Replies
9. Shell Programming and Scripting
Hi Everyone,
I have an unusual requirement. Here is where i am stuck for sometime now...
I have this text file.. lets say .. output.sql...
it has lot of entries... here below is part of the entry...
.. . . . . . . . . . . . . . . . .... (3 Replies)
Discussion started by: vivek d r
3 Replies
10. Shell Programming and Scripting
hello Team,
I want to delete below linux using sed command but I am getting error.sed -i '/url=/status.cgi?hostgroup=/d' 3
error:sed: -e expression #1, char 32: unknown option to `s'
Could you please help me with correct syntax.
My line contain / character because of that I am getting... (4 Replies)
Discussion started by: ghpradeep
4 Replies
LEARN ABOUT DEBIAN
alzabo::runtime::uniquerowcache
Alzabo::Runtime::UniqueRowCache(3pm) User Contributed Perl Documentation Alzabo::Runtime::UniqueRowCache(3pm)
NAME
Alzabo::Runtime::UniqueRowCache - Implements a row cache for Alzabo
SYNOPSIS
use Alzabo::Runtime::UniqueRowCache;
Alzabo::Runtime::UniqueRowCache->clear();
DESCRIPTION
This is a very simple caching mechanism for "Alzabo::Runtime::Row" objects that tries to ensure that for there is never more than one row
object in memory for a given database row.
To use it, simply load it.
It can be foiled through the use of "Storable" or other "deep magic" cloning code, like in the "Clone" module.
The cache is a simple hash kept in memory. If you use this module, you are responsible for clearing the cache as needed. The only time it
is cleared automatically is when a table update or delete is performed, in which case all cached rows for that table are cleared.
In a persistent environment like mod_perl, you should clear the cache on a regular basis in order to prevent the cache from getting out of
sync with the database. A good way to do this is to clear it at the start of every request.
METHODS
All methods provided are class methods.
* clear
This clears the entire cache
* clear_table( $table_object )
Given a table object, this method clears all the cached rows from that table.
* row_in_cache( $table_name, $row_id )
Given a table name and a row id, as returned by the "Alzabo::Runtime::Row->id_as_string" method, this method returns the matching row
from the cache, if it exists. Otherwise it returns undef.
* delete_from_cache( $table_name, $row_id )
Given a table name and a row id, as returned by the "Alzabo::Runtime::Row->id_as_string" method, this method returns the matching row
from the cache.
* write_to_cache( $row_object )
Given a row object, this method stores it in the cache.
AVOIDING THE CACHE
If you want to not cache a row, then you can pass the "no_cache" parameter to any table or schema method that creates a new row object or a
cursor, such as "Alzabo::Runtime::Table->insert()", "Alzabo::Runtime::Table->rows_where()".
AUTHOR
Dave Rolsky, <autarch@urth.org>
perl v5.8.8 2007-12-23 Alzabo::Runtime::UniqueRowCache(3pm)