Hi everyone,
I am new to shell scripting, and would appreciate your help on following problem.
I need to search a file for a pattern, then get the number of each line that matches the given pattern.
Then I need to search those specific line numbers from the first file in a second file and print the entire lines.
I tried with grep -n 'pattern' from the first file, which gives me:
21: pat
Here Is a problem I am facing with awk.
Query --> I want to search for a string in a file and print next 15 lines below the matched string.
1.We do not have GNU grep so cannot use grep -A or grep -B commands.
2. Instead of passing the search pattern as a string to awk.
Suppose im in a directory A. which has sub-directories x/y/z m/n/p etc. Iam only considered with those which have a file netl.oa at the lowermost level. So i used the find command which gives me a list in the form
Code:
./abc/def/ghi/jkl/netl.oa
and so on
Now i want the names abc def jkl and ghi.
Hi,
Can you please help me out here?
I have an XML file, the file is made up of one line.
What I am trying to do is extract the "finalNumber" attribute value from the file via Putty. Rather than having to download a copy and search using notepad++.
I've built up a regular expression that I've tested on an On-line Tool, and tried using it within a sed command to duplicate grep functionality.
How can I instruct expect to look for something like "Generating foo-[pattern].tgz" in the stream and return the pattern so I can use it in future commands?
I find myself repeatedly performing the same actions and would like to automate them using expect. I ssh'ing onto one system and running a script on it that generates a file, then I scp the file from that system onto two other systems.
I got a problem to read standard input file, to edit the standard input, and to write the output to other file.
I've got a problem with my shell scrip, when I ran the shell ./Test1 hello result
it suppose to take hello as standard input and result as standard output.
Hi All,
i'm writing a script where i have to grep for a pattern and the 3 lines after the pattern and comment them out.
Note that i have to do this for multiple files, i am able to grep the pattern and the next 3 lines but since solaris does not recognize the -i option, i was wondering if there was any workaround.