Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
680 views

Unix Assignments Xplore

The document provides a list of 31 questions related to folder navigation, file permissions, searching and replacing patterns in files, sorting file contents, and performing other operations on files and directories. It includes questions about creating a folder structure, moving and copying files between folders, searching for regular expressions, changing file permissions, and using commands like cut, awk, sort to manipulate columns in files. The questions cover a range of tasks including file searching, sorting, permission changes, column manipulation, and searching/replacing patterns across multiple files.

Uploaded by

Harshit Garg
Copyright
© © All Rights Reserved
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
680 views

Unix Assignments Xplore

The document provides a list of 31 questions related to folder navigation, file permissions, searching and replacing patterns in files, sorting file contents, and performing other operations on files and directories. It includes questions about creating a folder structure, moving and copying files between folders, searching for regular expressions, changing file permissions, and using commands like cut, awk, sort to manipulate columns in files. The questions cover a range of tasks including file searching, sorting, permission changes, column manipulation, and searching/replacing patterns across multiple files.

Uploaded by

Harshit Garg
Copyright
© © All Rights Reserved
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
You are on page 1/ 4

Question on Folder Navigation:

Create folders in the below Structure:

HomeDir/Parent1/Child

HomeDir/Parent2/Child

Create Three files(filea,fileb,filec) in HomeDir/Parent1/Child

Move the filea in HomeDir/Parent1/Child to HomeDir/Parent2/Child

Copy the files fileb to HomeDir/Parent2/Child

1. -Diaplay the perticuler user from the logged in users.


2. -Find out the perticuler pattern in a given file / All files and display line Number, Count and
redirect the Ouput to another file.
3. -Find out the in given file / All files,which are not having perticuler pattern and display
line Number,Count.
4. -Find out the perticuler pattern in All files of any given directory and display line
Number,Count and redirect the Ouput to another file.

5. -Write a command to Give rwr permission to Owner and give only the read permission to
others and take off the write permission to Group ?

6. -Search for a regular pattern(WITH 3 CHARACTERS -First character is 'A' and Last
Character is 'E' in a file/Files

7. -Search for a regular pattern(WITH 3 CHARACTERS -First character is 'A' and Last
Character is 'E' but
8. Second character is not EITHER OF B,C,D) in a file/Files

9. -Search in a file(S) for lines line starting with the an experssion,ending with an expression.

10. -Create a file with three columns seperated by Tab AND FETCH ONLY FIRST AND Third
columns values.

11. -Create a file with three columns seperated by any special any character .Fetch only first and
third columns values.

12. Create a file with three columns seperated by single space AND FETCH ONLY FIRST
AND Third columns values.

13. Creat a file in VI editor enter into Insert mode enter text of 10 lines with multiple words.
Append a word at the end of a current line.
Replace the line or word from current position.

14. Sort any given file on a given column number – Create a file with two to three columns of
values .Seperate the columns by any special character.
15. Display all the files containing TCS in the current file system

16. Find all the CPP files which are not being touched in the last 72 hours and change their
permission as below
-All Permissions to Owner
-Read and Execute permissions to Owner's Group
-Only Execute permissions to the Others – Not Owner's Group
17. Display all the .gch files which are not touched in the last year and remove them
18. Write the commands for the below scenarios,
a. Search for a given Pattern as content in multiple files, wrt 'case
insensitive search'
b. Search for the lines which start with Pattern/expression “begin” .

19. Look at the below data file(columns are Sno|Name|Class|School)


*************Contents of file: Datafile *****************
1|Deepu|First|Meridian
2|Neethu|Second|Meridian
3|Sethu|First|DAV
4|Theekshana|Second|DAV
5|Teju|First|Sangamithra
6|Theekshitha|Second|Sangamithra
******************************
a. Display the Students of first class students,
and columns order in the output should be ' School,Class,Name,Number ' and store in a
file
'OrderChanged'.

20. Display contents of a file(First and Fifth column from OUTPUT OF 'WHO'
Command) in a sort order?

21. Display contens of a file(First and Fifth column from OUTPUT OF 'WHO' Command)
in a sort order of second column in the file?

22. Assume a file with three columns,need to bring the third column to first column and
display the contents

23. Try using Cut and Awk commands on below problem statement

sample file: cutPasteEx


************************************************
Tata Consultancy Services

Tata Motors Limited

Expected output
*************************************************
Services Tata Consultancy
Limited Tata Motors
**************************************************

24. Order change using awk: Use above input file

Expected output
*************************************************
Services Tata Consultancy
Limited Tata Motors
*************************************************
Observe the difference between cut and awk

25. Print the LineNumper for the entered "input line of text" .

26. Display the lines which are having oddnumber of fields in teh input
*******************************************************************
sample input file
*******************************************************************
Tata Consultancy Services India

Tata Motors Limited

TataSteel

Expected Output
*******************************************************************
Tata Motors Limited

TataSteel
*******************************************************************

27. If the Subject 4 marks are greated than >75 then display the record
********************************************************************
Sample Input file :
Sub1Mark Sub2Mark Sub3Mark Sub4Mark SudentName
*******************************************************************
70 80 50 80 Rajesh
80 80 80 90 Siddharth
*******************************************************************

************** output: ********************************


80 80 80 90 Siddharth
********************************************************************

29 .Find all the files in the current file system and grant the permission of read and Execute
for others and all permissions for the User .Implement using exec and xargs.

30. Let us assume that a file in the below format,


fileName:HorizentalRecInput , Content as below,
2016 JANUARY 10TH, 2020 DECEMBER 5TH, 2010 MARCH 15TH

Write a statement / Command to get the below output?


JANUARY|DECEMBER|MARCH|

31. Write a script which will have multiple .cpp files contains a word : “TCS”
Replace the TCS with TataConsultanceServices at all occurance of all files in teh directory?

Note:Not to replace from VI ?

32.Write a script to read a file or folder from a user and provide full permissions?

You might also like