INTERVIEW QUESTIONS
OPERATING SYSTEMS
SHELL SCRIPTING
DETAILS
Question: What is use of "cut" command ??? give some examples. can we use "awk" or "sed" instead of "cut" ??? if yes then give some examples
Answer: This utility is use to cut out columns from a table or fields from each line of a file.
cut can be used as a filter.
Either the -b, -c, or -f option must be specified.
-b list
The list following -b specifies byte positions (for instance, -b1-72 would pass the first 72 bytes of each line). When -b and -n are used together, list is adjusted so that no multi-byte character is split.
-c list
The list following -c specifies character positions (for instance, -c1-72 would pass the first 72 characters of each line).
-d delim
The character following -d is the field delimiter (-f option only). Default is tab. Space or other characters with special meaning to the shell must be quoted. delim can be a multi-byte character.
|
Question:
What is use of "cut" command ??? give some examples. can we use "awk" or "sed" instead of "cut" ??? if yes then give some examples
Answer:
This utility is use to cut out columns from a table or fields from each line of a file.
cut can be used as a filter.
Either the -b, -c, or -f option must be specified.
-b list
The list following -b specifies byte positions (for instance, -b1-72 would pass the first 72 bytes of each line). When -b and -n are used together, list is adjusted so that no multi-byte character is split.
-c list
The list following -c specifies character positions (for instance, -c1-72 would pass the first 72 characters of each line).
-d delim
The character following -d is the field delimiter (-f option only). Default is tab. Space or other characters with special meaning to the shell must be quoted. delim can be a multi-byte character. Source: CoolInterview.com
"cut" it self giving the meaning.
It will cut words,charecters also by length.
see "man cut " you will get more information
Thanks, -Amaresh http://ittipsandtrics.blogspot.com/
Source: CoolInterview.com
Answered by: Amaresh Das | Date: 7/9/2009
| Contact Amaresh Das
If you have the better answer, then send it to us. We will display your answer after the approval.
Rules to Post Answers in CoolInterview.com:-
- There should not be any Spelling Mistakes.
- There should not be any Gramatical Errors.
- Answers must not contain any bad words.
- Answers should not be the repeat of same answer, already approved.
- Answer should be complete in itself.
|