String manipulation Flashcards

1
Q

List line numbers

A

nl /etc/autofs.conf

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

scroll 6 line numbers from 13th line of a file

A

tail -n+13 /etc/autofs.conf | head -n 6

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Find particular type

A

find / -type f -name apache

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Replace string globally

A

sed s/mysql/MySQL/g /etc/snort/snort.conf > snort2.conf

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Replace once

A

sed s/mysql/MySQL/ snort.conf > snort2.conf

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Replace only first 2 occurrence

A

sed s/mysql/MySQL/2 snort.conf > snort2.conf

How well did you know this?
1
Not at all
2
3
4
5
Perfectly