10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi, i have file file.txt with data like:
START
03:11:30 a
03:11:40 b
END
START
03:13:30 eee
03:13:35 fff
END
jjjjjjjjjjjjjjjjjjjjj
START
03:14:30 eee
03:15:30 fff
END
ggggggggggg
iiiiiiiiiiiiiiiiiiiiiiiii
I want the below output
START (13 Replies)
Discussion started by: Jyotshna
13 Replies
2. Shell Programming and Scripting
I am trying to create a cronjob that will run on startup that will look at a list.txt file to see if there is a later version of a database using database.txt as the source. The matching lines are written to output.
$1 in database.txt will be in list.txt as a partial match. $2 of database.txt... (2 Replies)
Discussion started by: cmccabe
2 Replies
3. Shell Programming and Scripting
echo 'String#1 and String#2' | egrep -o -m 1 'String#.{1}'
String#1
String#2
I'm trying to just match the first occurrence of 'String#' + 1 character. I thought the "-m 1" switch would do that for me. Instead I get both occurrences. Can somebody provide some insight?
Thanks! (5 Replies)
Discussion started by: sudo
5 Replies
4. UNIX for Dummies Questions & Answers
hey guys, i have been trying to work this thing out with sed with no luck :confused:
i m looking for a way to replace only the first occurrence after a match
for example :
Cat
Realized what you gotta do
Dog
Realized what you gotta do
Sheep
Realized what you gotta do
Wolf
Realized... (6 Replies)
Discussion started by: boaz733
6 Replies
5. Shell Programming and Scripting
Hi,
I have a file which contained a set of numbers like
Col1 col2 col3 col4
1 sa 13 0
2 sb 14 0
3 sc 15 9
4 sd 16 -9
5 sd 20 -2
6 sd 20 4
Here in last column I need to count the zeros, positive values and negative values,
please help me to do that. (2 Replies)
Discussion started by: Shenbaga.d
2 Replies
6. Shell Programming and Scripting
Lets say I have file.txt:
(Product:Price:QuantityAvailable) (: as delimiter)
Chocolate:5:5
Banana:33:3
I am doing a edit/update function.
I want to change the Quantity Available, so I tried using the SED command to replace 5, but my Price which is also 5 is changed instead.
(for the Banana... (13 Replies)
Discussion started by: andylbh
13 Replies
7. Shell Programming and Scripting
I am writing a package manager in BASH and I would like a small snippet of code that finds lines that match exact input and count them. For example, my file contains:
xyz
xyz-lib2.0+
xyz-lib2.0
xyz-lib1.5
and "grep -c xyz" returns 4.
The current function is:
# $1 is the package name.... (3 Replies)
Discussion started by: cooprocks123e
3 Replies
8. Shell Programming and Scripting
I am trying to match a pattern exactly in a shell script. I have tried two methods
awk '/\<mpath${CURR_MP}\>/{print $1 $2}' multipath
perl -ne '/\bmpath${CURR_MP}\b/ and print' /var/tmp/multipath
Both these methods require that I use the escape character. I am guessing that is why... (8 Replies)
Discussion started by: bash_in_my_head
8 Replies
9. Shell Programming and Scripting
I am looking to get a output of "2 apple found" from the awk command below.
black:34104 tomonorisoejima$ cat tomo
apple apple
black:34104 tomonorisoejima$ awk '/apple/ {count++}END{print count " apple found"}' tomo
1 apple found
black:34104 tomonorisoejima$ (5 Replies)
Discussion started by: soemac
5 Replies
10. Shell Programming and Scripting
Hi All,
I have an input below. If the term in the 1st column is equal, print the last row which 1st column is equal.In the below example, it's " 0001 k= 27 " and " 0004 k= 6 " (depicted in bold). Those terms in 1st column which are not repetitive are to be printed as well. Can any body help me... (9 Replies)
Discussion started by: Raynon
9 Replies