InterviewSolution
Saved Bookmarks
| 1. |
What is the importance of sed command and awk command? |
Answer»
In this case, “s” command in sed replaces the string Hi with “Hello”. Output: Hello Gourav
An awk command/utility assigns variables in following way: $0 -> For whole LINE (e.g. Hello Aisha) $1 -> For the FIRST FIELD i.e. Hello $2 -> For the second field Execution over Shell Interpreter/Editor awk ‘{print $0}’ script10The above script prints all the 3 lines completely. Output: Hello Aisha Hello Rohan Hello GouravExecution over Shell Interpreter/Editor awk ‘{print $1}’ script10The above script prints only the first word i.e., Hello from each line. Output: Hello Hello Hello |
|