In a file , how to retrieve the lines which are the
multiples of 50 ? like 50,100,150th lines etc.

Answer Posted / shivu

root@chandru-VirtualBox:~# egrep "^[0-9]*[0|5]0" file
50
100
150
200
250
300
350
400
450
500
501
502
503
504
505
506
507
508
509
550
600
650
700
750
800
850
900
950
1000

But the below one is
root@chandru-VirtualBox:~# egrep "^[0-9][0|5][0]" file
100
150
200
250
300
350
400
450
500
550
600
650
700
750
800
850
900
950
1000

This is also not correct. up to some extend it is ok.

Is This Answer Correct ?    1 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What lives in a shell?

528


Where are cowrie shells found?

567


What exactly is a shell?

594


how to get part of string variable with echo command only?

577


What are the different communication commands available in the shell?

510






What is shell variable?

523


What language is bash written in?

547


What is meant by dos operating system?

567


What does egrep mean?

561


Explain about debugging?

600


What are the four fundamental components of every file system on linux?

1154


How will you emulate wc –l using awk?

900


What is a beat in a script?

529


What is path in shell script?

626


Can we run shell script in windows?

571