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
What are the default permissions of a file when it is created?
How does path variable work?
Set up a Sev 2 alert when the Primary WA service fails. A windows batch script needs to be created that will monitor the WA service on the Primary and when the service stops/fails a Sev 2 TT is generated for a particular team ?
How to print all array elements and their respective indexes?
What are the different types of commonly used shells on a typical linux system?
What is path in shell script?
Is cmd a shell?
What are the different variables present in linux shell?
How can I send a mail with a compressed file as an attachment?
How many fields are present in a crontab file and what does each field specify?
What can scripts do?
How do I debug a shell script?
What does echo $0 do?
what is info area how many types?
How to use arguments in a script?