Jump to content

Unix questions urgent......


Recommended Posts

Posted

Given a directory on a Linux/Unix file system that contains one or more text files, how would you do the following:
a. Find all lines with the word “Exception” in all files
b. Find the last 5 lines with the word “Exception” in a single file
c. Find the line number of the first line with the word “Exception” in every file


  Above questions ki evarikaina answers teliste cheppandi please. Oka job ki apply cheste quiz answer cheyyamannaru.Chaala urgent help cheyyandi
  • Replies 38
  • Created
  • Last Reply

Top Posters In This Topic

  • krldr871

    12

  • mba

    8

  • robo

    7

  • shah01

    6

Popular Days

Top Posters In This Topic

Posted

a) grep -H abc *
current directory lo unte work avvuddi ee command..abc is ur search string (Exception in ur case)

b) tail -n 5 test1 |grep abc
tail prints the last part of a file, so -n 5 ante last 5 lines..and piping it with grep for "abc"

c) grep -o -m 1 -n "abc" test1
here abc is the search string and test1 is the filename. change it according to ur requirements.

ivanni standard way oo kado naku telidu..because im not a sys admin

Posted

grep ee vadali ba anitiki but exact ga ante try chesi chepagalanu linux ledu

Posted

[quote author=John Galt link=topic=203023.msg2475147#msg2475147 date=1308146068]
a) grep -H abc *
current directory lo unte work avvuddi ee command..abc is ur search string (Exception in ur case)

b) tail -n 5 test1 |grep abc
tail prints the last part of a file, so -n 5 ante last 5 lines..and piping it with grep for "abc"

c) grep -o -m 1 -n "abc" test1
here abc is the search string and test1 is the filename. change it according to ur requirements.

ivanni standard way oo kado naku telidu..because im not a sys admin
[/quote]b ans correct ee na

Posted

[quote author=ROBO link=topic=203023.msg2475158#msg2475158 date=1308146335]
b ans correct ee na
[/quote]
ohh shit..last 5 lines with exception aa..nenu only last 5 lines search cheyali ankunnaa  H&T@ H&T@ H&T@ H&T@
aagu kotha command ista

Posted

Naaku vaadu inka testing lo questions ichaadu. Avi emaina meeku vaste cheputaara. Ee questions correct ga answer cheste interview ki pilustaademo.

Posted

b) grep -n abc test1 |tail -n 5

this should work  &D_@@ &D_@@ &D_@@ &D_@@ &D_@@ emantaav ROBO BOB  CITI_$D# CITI_$D# CITI_$D#

Posted

[quote author=shah01 link=topic=203023.msg2475166#msg2475166 date=1308146584]
Naaku vaadu inka testing lo questions ichaadu. Avi emaina meeku vaste cheputaara. Ee questions correct ga answer cheste interview ki pilustaademo.
[/quote]
testing naku idea ledu babai..vere janalu unnaru kada help chestaremo chudu..and by the way, b answer kothadi icha chudu..

Posted

[quote author=John Galt link=topic=203023.msg2475167#msg2475167 date=1308146611]
b) grep -n abc test1 |tail -n 5

this should work  &D_@@ &D_@@ &D_@@ &D_@@ &D_@@ emantaav ROBO BOB  CITI_$D# CITI_$D# CITI_$D#
[/quote] @gr33d @gr33d  you rock you rock you rock

so is it possible to use find for question a

Posted

Chaala thanks.
Nenu try chestaanu le
Ikkada questions veste emaina problem avutundaaa

Posted

[quote author=John Galt link=topic=203023.msg2475147#msg2475147 date=1308146068]
a) grep -H abc *
current directory lo unte work avvuddi ee command..abc is ur search string (Exception in ur case)

b) tail -n 5 test1 |grep abc
tail prints the last part of a file, so -n 5 ante last 5 lines..and piping it with grep for "abc"

c) grep -o -m 1 -n "abc" test1
here abc is the search string and test1 is the filename. change it according to ur requirements.

ivanni standard way oo kado naku telidu..because im not a sys admin
[/quote] sHa_clap4 sHa_clap4

Posted

[quote author=John Galt link=topic=203023.msg2475147#msg2475147 date=1308146068]
a) grep -H abc *
current directory lo unte work avvuddi ee command..abc is ur search string (Exception in ur case)

b) tail -n 5 test1 |grep abc
tail prints the last part of a file, so -n 5 ante last 5 lines..and piping it with grep for "abc"

c) grep -o -m 1 -n "abc" test1
here abc is the search string and test1 is the filename. change it according to ur requirements.

ivanni standard way oo kado naku telidu..because im not a sys admin
[/quote]last question every file annadu... one file kaadhu..  ^G#W

Posted

[quote author=mba link=topic=203023.msg2475193#msg2475193 date=1308147804]
last question every file annadu... one file kaadhu..  ^G#W
[/quote]
answer cheppachu kadha mari  ^G#W ^G#W ^G#W

Posted

[quote author=Cheddi Chinnodu link=topic=203023.msg2475195#msg2475195 date=1308147848]
answer cheppachu kadha mari  ^G#W ^G#W ^G#W
[/quote]telisthe eppudo cheppe vaadini.. kaastha kashtapadaalli... :D :P

ee paatiki baabu quiz ayipoyi vuntundhi ani thinking

×
×
  • Create New...