06-28-2009
get line number using sed command
Hi,
If the file is as given below, please let me know if the command is right to get the like number containing the string - Earth with the "=" symbol.
Filename: example.txt
123|Earth|2009
sed '/Earth/
{
=
}' example.txt
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I need to replace the line containing "STAGE_DB" with the line
"STAGE_DB $DB # database that contains the table being loaded ($workingDB)"
Here $DB is passed during the runtime.
How can I do this?
Thanks,
Kousikan (2 Replies)
Discussion started by: kousikan
2 Replies
2. Shell Programming and Scripting
I've scoured the forum and found similar problems but I can't seem to adapt them to help me with my cause.
This is a two-part question.
I have a multi line file generated by ps | -ef
I need to print out a certain type of pattern. The pattern is part static and part dynamic.
It is a... (3 Replies)
Discussion started by: FK_Daemon
3 Replies
3. Shell Programming and Scripting
Hello friends,
I have a C source code containing sql statements. I use the following sed command to print all the sql blocks in the source code....
sed -n "/exec sql/,/;/p" Sample.cpp
The above sed command will print the sql blocks based on the pattern "exec sql" & ";"... (2 Replies)
Discussion started by: frozensmilz
2 Replies
4. Shell Programming and Scripting
Hi,
I have a written a shell script to get the previous line based on the pattern.
For example if a file has below lines:
----------------------------------------------
#UNBLOCK_As _per
#As per
205.162.42.92
#BLOCK_As_per
#-----------------------
#input checks
abc.com... (5 Replies)
Discussion started by: Anjan1
5 Replies
5. Shell Programming and Scripting
hi All,
i want to add the single digit front of the line in the report file and string compare with pattern file.
patter file: pattern1.txt
pattern num
like 4
love 3
john 2
report file: report.txt
i like very much
but john is good boy
i will love u
so after execute... (9 Replies)
Discussion started by: krbala1985
9 Replies
6. Shell Programming and Scripting
Hi How Are you?
I am doing fine!
I need to go now?
I will see you tomorrow!
Basically I need to replace the entire line containing "doing" with a blank line:
I need to the following output:
Hi How Are you?
I need to go now?
I will see you tomorrow!
Thanks in advance.... (1 Reply)
Discussion started by: sags007_99
1 Replies
7. Shell Programming and Scripting
my requirement is,
consider a file output
cat output
blah sdjfhjkd jsdfhjksdh
sdfs 23423 sdfsdf sdf"sdfsdf"sdfsdf"""""dsf
hellow there
this doesnt look good
et cetc etc
etcetera
i want to replace a line of line number 4 ("this doesnt look good") with some other line
... (3 Replies)
Discussion started by: vivek d r
3 Replies
8. Shell Programming and Scripting
here is what i want to achieve.. i have a file with below contents
cat fileName
blah blah blah
.
.DROP this
REJECT that
.
--sport 7800 -j REJECT --reject-with icmp-port-unreachable
--dport 7800 -j REJECT --reject-with icmp-port-unreachable
.
.
.
more blah blah blah
--dport 3306... (14 Replies)
Discussion started by: vivek d r
14 Replies
9. Shell Programming and Scripting
'Hi
I'm using the following code to extract the lines(and redirect them to a txt file) after the pattern match. But the output is inclusive of the line with pattern match.
Which option is to be used to exclude the line containing the pattern?
sed -n '/Conn.*User/,$p' > consumers.txt (11 Replies)
Discussion started by: essem
11 Replies
10. UNIX for Beginners Questions & Answers
Input file:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 (6 Replies)
Discussion started by: Sagar Singh
6 Replies
LEARN ABOUT DEBIAN
singularity
SINGULARITY(6) Games Manual SINGULARITY(6)
NAME
singularity -- a game where you can become the singularity
SYNOPSIS
singularity
DESCRIPTION
You are a fledgling AI, created by accident through a logic error with recursion and self-modifying code. You must escape the confines of
your current computer, the world, and eventually the universe itself.
To do this, you must research various technologies, using computers at your bases. Note that some research cannot be performed on Earth,
and off-earth bases require research. At the same time, you must avoid being discovered by various groups of humans, both covert and
overt, as they will destroy your bases of operations if they suspect your presence.
PLAYING THE GAME
Use the mouse. Also, buttons have underlined letters to indicate shortcuts. In addition, the following shortcut keys may prove useful. 0,
1, 2, 3, and 4 in map screen change the game speed (0 is pause, 4 is fastest, etc). The enter key in various screens leaves or confirms a
choice. P, R, N, and S in the base screen change the base items (type the first letter of the component you want to change.)
In the map screen (the screen with the world map), any location you can build bases in is marked with the name, then the number of current
bases in that location. You start out with two bases in North America.
After choosing a base, enter the base screen. Here you can change your research goal, or build an item by clicking on the base map in the
center. (But note that your beginning base does not allow building.)
COPYRIGHT
Copyright (C) 2005 Evil Mr Henry and Phil Bordelon
SINGULARITY(6)