0% found this document useful (0 votes)
13 views

Linux Basic 2

The document outlines a Linux assignment involving the use of sed, awk, and grep commands for file manipulation and data extraction. It includes tasks such as creating files, modifying content, printing specific lines, and searching for patterns within text. The assignment covers various command options and their applications in handling text files effectively.

Uploaded by

LE 406 uday
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

Linux Basic 2

The document outlines a Linux assignment involving the use of sed, awk, and grep commands for file manipulation and data extraction. It includes tasks such as creating files, modifying content, printing specific lines, and searching for patterns within text. The assignment covers various command options and their applications in handling text files effectively.

Uploaded by

LE 406 uday
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

LINUX

ASSIGNMENT-2
Sed:-
1. create a file with a name of “course_names” in “Front_end” directory ?
2. enter below information in to the “course_names” file

1,Physical Design,PD
2,physical Design,PD
3,static timing analysis,STA
4,Static timing analysis,STA
5,Design verification,DV
6,Design verification,dV
7,formal verification,FV
8,formal verification, fV
9,design for testability,DFT
10,Design for testability,DFT
11,Physical Design,PD
by using this sed command print this information in terminal ?

3. print only “1- 5” lines by using sed command ?


4. replace “ Physical Design “ with a name of “PNR” using sed command
entire file?
5. print only “ Design verification” lines using sed commands ?
6. print only “odd” number lines using sed command ?
7. print only “even” number lines using sed command ?
8. replace the word “ PD“ to “placement and routing “ in the first line only?
9. replace the word “ PD“ to “physical design “ in the second line only?
10. replace the word “ ,“ to “- “ entire file?
Add additional below information to the “course_name” file to see the
difference purpose..

1,Physical Design,PD , Design verification,DV


2,physical Design,PD , Design verification,DV
3,static timing analysis,STA , Design for testability,DFT
4,Static timing analysis,STA , Design
5,Design verification,DV , Physical Design
6,Design verification,dV , Physical Design
7,formal verification,FV
8,formal verification, fV
9,design for testability,DFT , Physical Design
10,Design for testability,DFT , Physical Design
11,Physical Design,PD , Design verification

11. replace the first word in every line “Design” with “DESIGN” entire file ?
12.replace the second word in every line “Design” to “DESIGN” entire file ?
13. delete last line by using sed command ?
14. delete 3 to 5 lines using sed command ?
15. delete all lines containing “verification” ?
16. add empty line after every line by using sed command
16.what is the command to “Delete all the empty lines from a file” ?

awk;-

create afile with a name of employee.txt enter this information


Ajay Manager account 45000
Sunil clerk account 25000
Varun manager sales 50000
amit manager account 52000
Tarun peon sales 15000
deepak clerk sales 15000
Sunitha clerk account 25000
Varsha manager sales 50000

1.print all information by using awk command ?


2.print only manager presented lines using awk command ?
3.print only 1st column using awk command?
4.using awk command print 1st column and last column ?
5.using awk command print only 2nd column ?
6.using awk command assign numbers to the each line ?
7. print only 3rd line to 6th lines using awk command?
8.insert “batch_name” starting of each line by using awk command ?
9.print only last line by using awk command ?
10.Print only 1st and 2nd column field of 3rd row ?
11.assign numbers to the each line and insert “batch_name” starting of each
line?
12.print only last line and its number by using awk command ?
13. print only last line number using awk command ?
14. print 2 table by using awk command?
15. by using the “,” print 1st column by using awk field separator command?
16. by using the “,” print 2nd column by using awk field separator command?

Grep:-

create one file consider below example information in a file

THIS LINE IS THE 1ST UPPER CASE


LINE IN THIS FILE. this line is the 1st lower case
line in this file. This Line Has All
Its First Character Of The Word With Upper Case.
Two lines above this line is empty.
And this is the last line.

1. search “this” word by using “grep” cmd?


2.print how many times “this” word present in file by using grep ?
3. what is the command to print searching word either lower case or upper case
and print how many times this “this” word present in file and
count ?
4. what is the command to print only “this” word line by line and print “this”
word line by line with all cases ?
5. with all cases print “this” word how many times present in file by using
grep command ?
6. search for “l” letter in a file and print the entire line without all cases and
with all cases ?
7. what is the command to print only first two matches with all cases and
without cases ?
8.find the line containing only “this “ word in a file what is the command ?
9. search the “Has” word in a file and prints 3 lines coming after the
pattern ?
10.search “Has” word in a file and prints 1 line before the pattern ?
11.search “Has” and prints 1 lines coming before and after the pattern ?
12.search for the “above “ word in a file and except “above” word
containing line print remaining lines ?

You might also like