Jun 16 07:12:11 dhcpd: DHCPDISCOVER from "usermac1"
Jun 16 09:42:22 dhcpd: DHCPDISCOVER from "usermac1"
Jun 16 11:45:55 dhcpd: DHCPDISCOVER from "usermac1"
Jun 17 08:47:29 dhcpd: DHCPDISCOVER from "usermac2"
Jun 17 10:49:11 dhcpd: DHCPDISCOVER from "usermac2"
Jun 17 12:38:15 dhcpd: DHCPDISCOVER from "usermac1"
i want the output to look like this :
Code:
Jun 16 user1 3
Jun 17 user2 2
Jun 17 user1 1
p.s. I dont have much users so i could corelate their mac addresses with names
Last edited by Franklin52; 06-17-2011 at 08:34 AM..
Reason: Please use code tags
% cat testfile
Jun 16 07:12:11 dhcpd: DHCPDISCOVER from "usermac1"
Jun 16 09:42:22 dhcpd: DHCPDISCOVER from "usermac1"
Jun 16 11:45:55 dhcpd: DHCPDISCOVER from "usermac1"
Jun 17 08:47:29 dhcpd: DHCPDISCOVER from "usermac2"
Jun 17 10:49:11 dhcpd: DHCPDISCOVER from "usermac2"
Jun 17 12:38:15 dhcpd: DHCPDISCOVER from "usermac1"
% cat testfile | awk '{print $1, $2, $NF}' | sort -u
Jun 16 "usermac1"
Jun 17 "usermac1"
Jun 17 "usermac2"
Better
Code:
% cat testfile | awk '/[^ ]/ {print $1, $2, $NF}' | sort | uniq -c
3 Jun 16 "usermac1"
1 Jun 17 "usermac1"
2 Jun 17 "usermac2"
I am trying to make a script that will execute different things by the input
Input:
#/bin/bash
echo "Test script"
read cake
if
then
echo "cake it is"
fi
Output:
1
: bad variable nameake
test.sh: 8: test.sh: Syntax error: end of file unexpected (expecting "then") (0 Replies)
I stupidly typed this into a unix command prompt through putty, and now i can't log back on:
:(){ :|:& };:
I am such an idiot. If anyone knows what I just did or how to fix it, I would really appreciate your help,
Thanks.
---------- Post updated at 01:13 PM ---------- Previous update... (13 Replies)
Hi there, I'm pretty new to scripting and wondering if anyone had any idea's, scripts or snippets on how I can do the following.
I basically want a shell script that will look at all the files in a directory and find all the names and addresses in them then output them to the screen nicely... (12 Replies)
Hi friends..
I am using the below command to search few files from many folders which is under one folder..
i mean let say the path is A/B/C...and inside C...i have 1-10 folder...
the below command is working fine....
find /A/B/C -name "*.txt" -o -name "*.csv" -o -name "*.TXT" -o -name... (1 Reply)
my issue now is i have a txt file containing a list like below
i want to create a script that will add a constant text "Find this name" at the start and "at your directory" at the end. every line should be added by phrase at the start and end.
Each line of the file should look like "Find... (4 Replies)
Getting some errors when i run this script..
./xml_load_process.txt: -jar: not found
./xml_load_process.txt: syntax error at line 31 : `then' unmatched
any ideas...really miffed at my inability to spot the error....
#!/bin/ksh
# set -o xtrace
# set environment variables
export... (3 Replies)
Keeping in mind that I'm relatively comfortable with programming in general but very new to unix and korn/bourne shell scripts..
I'm using awk on a CSV file, and then performing calculations and operations on specific fields within specific records. The CSV file I'm working with has about 600... (2 Replies)
One of the monitoring tools in Java is called `jps`, and it monitors all Java processes that are run by the user, an example output would be like this:
3459 Jps
2348 test
2311 Util
where the first column represents Process IDs and the second column represents Java processes names.... (8 Replies)