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 does chmod do?
Explain about login shell?
Why do we write bin bash in shell scripts?
When should shell programming/scripting not be used?
What is sh in shell script?
What is scripting used for?
How do you find out What is your shell?
How to get the first line from a file using just the terminal?
How to pass an argument to a script?
What is path in shell script?
What are the different communication commands available in the shell?
Where are cowrie shells found?
What is the syntax of while loop in shell scripting?
How do you know which shell I am using?
What happens on a system call?