I've got a script at the moment that looks like this:
For the 6th option in this particular menu script I'm trying to get the following command:
to fetch from the last file all logins of a certain amount of hours, but I am trying to provoke the user to type in the particular amount of hours they want to see. So where I have the variable tim, I expected this to work:
but it doesn't seem to want to comprehend having an open bracket inside the grep, without a closed one. It does work without the brackets, but then shows not only the login lengths matching the hours, but also the actual timestamps aswell, which I don't want.
How can I make the grep work inside the variable?
Cheers for any help in advance, and since this is my first query here and may have some more, is it better to create a new topic each time or shall I continue to use this thread?
Hello Friends,
I have a password file at /etc/password.bak in which the fields are present in the below format i.e. each field is seperated by ":"
vbjr3:x:1007:1007:student users:/home/vbjr3:/bin/bash
dbhyt2:x:1008:1008:student users:/home/dbhyt2:/bin/bash
bbwe3:x:1009:1009:student... (1 Reply)
Dear Experts,
Need your help.
Typically we use "grep" to search and display a pattern in a txt file.
However, here what we want is, we want to grep a line which contains 4 words any where in a line.
For example.
File has 10,000,000 lines in it out of which there is a particular line which... (1 Reply)
Hi All,
I have a log file and I want to parse the logfile with a script.A sample text is shown below:
I would grep on "return code " on this file. Any idea how the lines above and below the grep patterns could also be extracted.
Thanks!
nua7
The runLoggingInstall return code is 0... (3 Replies)
Hi All,
I was recently helped out 'big time' with my last post on changing multiple file formats (thx, scott1256ca and bakunin)!
My new question is about selecting and displaying columns in a file using (possibly) grep. Several of my data files are spreadsheet format (columns separated by... (8 Replies)
Using shell scripts, I use grep to find the word “error” in a log file:
grep error this.log.
How can I print or get the line 3 lines below the line that word “error” is located?
Thanks in advance for your response. (9 Replies)
Hello.
I have a dir of 1500+ dir. In these dirs is a file host, with a tag <x_tag>.
I need to :
1. grep for all dir that contain this host file that contain <x_tag>
2. print a list of these host files containing <x_tag>
is this better to egrep this? (5 Replies)
Can you grep for a sentence. I have to search logs everyday at work and I was wondering if I could search for a string of words instead of just one.
for example, if I had to find this sentence:
"Received HTTP message type"
How would I grep it (2 Replies)
Is there a way to grep for something and then print out 10 lines after it.
for example if I want to grep for a word, then output the following 10 or whatever number of lines after the word. (5 Replies)