I’m wondering how I can query by IP address using sed, and it will show which interface name that is using it. For example.. I would expect it to come back with ETH0 Answer You should use this comand : Hope this help !
Incorrect format of sending mail from Linux shell
My file format is as below: But if I mail it to my mailbox, the format will be as below: How can I keep my original format when I send file content to my mailbox!? Answer The SMTP specification says that end-of-line in SMTP messages is where in Unix/Linux the end of line is Run the text though a tr
awk in non-interactive is leaving some data missing
I’m running an awk command in a shell script, and it’s breaking the datafile. All of the data doesn’t load, and there’s a newline character at the end of each line. If I run this as a command, it works perfectly. I’ve just found that i can use fflush() and it seems to have solved…
Pop function for stack has unexpected behaviour [closed]
Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 6 years ago. Improve this question I was just taking lecture on behalf of my Guide and one student given this…
Get information in the Log file
I have a log file and below is sample log in that file. I changed only here column 3rd and 4th as SourceNo,Destination for reference. my requirement – I need to get separately, Source wise total count that sent to Destination begin with 44 code. i tried with grep and awk but it didn’t work. apprec…
How to gather IP and User Agent info and uniq them base IP address from nginx access log with AWK?
i have a sample log file I want to collect all the ip and user agent info to a file, and uniq the same IP address, how can i do with awk ? output like: Answer With sed, sort and uniq :
How to code a shell script to run a program when the system login? [closed]
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack …
Cronjob script isn’t working as expected
I have a script that work perfectly fine when I manually run it by myself, but does not seem to run properly from crontab. The main error is that the (external) environment variables are not being set. I added SHELL=/bin/bash above the cronjob definition but still got the same errors. The script I have copied…
Undefined references when linking with gcc -lnetsnmp
I’m trying to compile and run my code on a raspberry pi which needs the snmp libraries. However, I get linking errors such as “undefined reference to ‘EVP_DigestUpdate’”. I’ve been researching this issue for the past few days and found out that this usually happens when snmp can&…
Print text in between a string pattern and a new line in bash
I have a text file that looks like this: and I’m trying to print the part between 29.04.16_09.35 (included) and the first empty line. I thought sed would work and tried using this code: but it prints everything from 29.04.16_09.35 to the end of the file. I also tried by using a single n but it still pri…