Wednesday, June 25, 2014

unix-linux grep challenge answers

Lets see first 2 questions answers:

1. use grep to count the number of lines in a file(wc -l).ok, little tricky. you should match for a newline character(\n). or, simply, we can match for everything between ^ (beginning of the line) and $(end of the line)
and count the number of matches (-c)

invent@sekar -  [/home/sekar/learning]
# cat grep-test-file1
hi123
hello111
invent@sekar -  [/home/sekar/learning]
# grep -c '^.*$' grep-test-file1
2
invent@sekar -  [/home/sekar/learning]

2. use grep to open a file like cat. ie, using grep, replicate the "cat filename" task (try both versions - grep and egrep)
simple. match for everything on the given file.
grep * filename --- will not work. single quote or double quote needed.

invent@sekar -  [/home/sekar/learning]
# grep '*' grep-test-file
invent@sekar -  [/home/sekar/learning]
# grep "*" grep-test-file
invent@sekar -  [/home/sekar/learning]
# grep -e * grep-test-file    (u know y this didnt work, right)
invent@sekar -  [/home/sekar/learning]
# grep -e "*" grep-test-file    ;# (egrep match for everything)
hi123
hello123 456
invent@sekar -  [/home/sekar/learning]
# grep ".*" grep-test-file    ;# (grep match for everything)
hi123
hello123 456
invent@sekar -  [/home/sekar/learning]

grep "." grep-test-file --- will it work? analyze and try this please..

Friday, June 6, 2014

Unix/Linux - grep quiz - challenges - questions


Unix / Linux - grep command quiz / questions
Level - basic and intermediate.

As i learnt on few sites, quiz / challenges are the best way of learning something new.
Answers are in link - http://shellandperl.blogspot.com/2014/06/unix-linux-grep-challenge-answers.html


1. Use grep to open a file like cat. ie, using grep, replicate "cat filename" task (try both versions - grep and egrep)
2. use grep to count the number of lines in a file(wc -l).
3. use grep to count the number of empty lines in a file
4. find out all capital words on a given file
5. find out all dollar values($50, $10, $1, etc) on a given file
6. find out all US cell numbers(123-456-7890, +1-123-456-7890) on a given file
7. use grep to count the number of words on a given file(wc -w).
8. grep only the full words
9. grep for ip addresses
10. take any command, for example wc, thru grep, read its man page and find out its AUTHOR 

Tuesday, June 3, 2014

Volkswagen Car Collections

i like to post my Volkswagen collection, then, as its a small car, for contrast reason, i thought to post a Limo and a truck as well...  
i remembered the line - "Big Man the Laltain, Small Man the Mombatti" from that novel.


 
Just for comparison, i included this truck here... 

 the yellow Cute yellow VW...


from my friend's home..

 another red cute:


Yellow beauty front view: