shah01 Posted June 15, 2011 Report Posted June 15, 2011 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 filesb. Find the last 5 lines with the word “Exception” in a single filec. 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
krldr871 Posted June 15, 2011 Report Posted June 15, 2011 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 abctail 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
robo Posted June 15, 2011 Report Posted June 15, 2011 grep ee vadali ba anitiki but exact ga ante try chesi chepagalanu linux ledu
robo Posted June 15, 2011 Report Posted June 15, 2011 [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 abctail 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
krldr871 Posted June 15, 2011 Report Posted June 15, 2011 [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
shah01 Posted June 15, 2011 Author Report Posted June 15, 2011 Naaku vaadu inka testing lo questions ichaadu. Avi emaina meeku vaste cheputaara. Ee questions correct ga answer cheste interview ki pilustaademo.
krldr871 Posted June 15, 2011 Report Posted June 15, 2011 b) grep -n abc test1 |tail -n 5this should work &D_@@ &D_@@ &D_@@ &D_@@ &D_@@ emantaav ROBO BOB CITI_$D# CITI_$D# CITI_$D#
krldr871 Posted June 15, 2011 Report Posted June 15, 2011 [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..
robo Posted June 15, 2011 Report Posted June 15, 2011 [quote author=John Galt link=topic=203023.msg2475167#msg2475167 date=1308146611]b) grep -n abc test1 |tail -n 5this should work &D_@@ &D_@@ &D_@@ &D_@@ &D_@@ emantaav ROBO BOB CITI_$D# CITI_$D# CITI_$D#[/quote] @gr33d @gr33d you rock you rock you rockso is it possible to use find for question a
shah01 Posted June 15, 2011 Author Report Posted June 15, 2011 Chaala thanks.Nenu try chestaanu leIkkada questions veste emaina problem avutundaaa
Cheddi Chinnodu Posted June 15, 2011 Report Posted June 15, 2011 [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 abctail 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
mba Posted June 15, 2011 Report Posted June 15, 2011 [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 abctail 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
Cheddi Chinnodu Posted June 15, 2011 Report Posted June 15, 2011 [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
mba Posted June 15, 2011 Report Posted June 15, 2011 [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 :Pee paatiki baabu quiz ayipoyi vuntundhi ani thinking
Recommended Posts