Fetching address and user details from log file


 
Thread Tools Search this Thread
Top Forums UNIX for Beginners Questions & Answers Fetching address and user details from log file
# 8  
Old 05-29-2018
Try

Code:
gunzip log.2018-05-23.gz | awk '
BEGIN                           {HD = "Date    Program    line1    line2    city    stateCode    postalCode    countryCode"
                                 MX = split(HD, HDFLDS)
                                }

/CartService/                   {TMP = $1 " " $2 OFS $5
                                }

/Failed to calculate US Tax.*{/ {while (!(T1 ~ /}/))    {getline T1
                                                         gsub (/ *" */, _, T1)
                                                         split (T1, T2, ":")
                                                         OUT[T2[1]] = T2[2]
                                                        }

                                 if (!HDprinted) print HD
                                 HDprinted = 1

                                 printf "%s", TMP
                                 for (i=3; i<=MX; i++) printf OFS "%s", OUT[HDFLDS[i]]
                                  printf ORS


                                 TMP = T1 = ""
                                 split ("", OUT)
                                }

 ' OFS="\t"

# 9  
Old 05-29-2018
Created a script file with the given code and redirected the execution to a text file(parseAwk.txt) but there was no records from the output.When the script executed initially it failed to locate the file so added the directory reference to the file as below

Code:
gunzip /home/nextStep/log.2018-05-23.gz

Output
Code:
 0 May 29 11:05 parseAwk.txt

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Cybersecurity

You are being directed to the US FBI where your IP address and details will also be logged.

Well, I thought I would share this code, which I normally do not share. The logs show this site is currently experiencing some "new hack" maybe attempting a buffer overflow or something similar. So, not really having any patience for this kind of criminal or childish behavior (have a touch... (7 Replies)
Discussion started by: Neo
7 Replies

2. Shell Programming and Scripting

How to log file processing details to database table usnig UNIX shell script?

we are getting files on daily basis.we need to process these files. i need a unix shell script where we can count 1-The no of files processed 2-No of data/record processed for each files. The script should log these details into a database table. If there is any error while file... (3 Replies)
Discussion started by: Atul kumar
3 Replies

3. Shell Programming and Scripting

Extract IP Address from Log File

I have a log file with several IP addresses in it:- 2012-12-06 16:05:05,885 NOTICE **SNMP** Alarm was created: (LicenseClientRejected) Client Remote Peer /125.111.64.125:2573 was Rejected Property=/125.111.64.125:2573, Client Remote Peer /125.111.64.125:2573 was Rejected **SNMP**.... (5 Replies)
Discussion started by: BHM
5 Replies

4. Shell Programming and Scripting

Formatting Report and Reading data and fetching the details from contents file

Data I was trying to write shell script which will be return the output in the below format First i was trying to do these using sed. sed -n '/.ksh/p' mainksh.ksh sed -e 's/*\(.*\)/\1/g' mainksh.ksh $RUN_DIR, $SUB_DIR and the variables which will be defined in the profile file. when i am... (0 Replies)
Discussion started by: rameshds
0 Replies

5. Solaris

Command History for a user with IP details

Hi We are sharing our envoirnment with our component teams. the plateform is SunOS 5.8 Generic_117350-41 sun4u sparc SUNW,Sun-Fire-V490. All team logs in the domain with same user and perform activities. Now for the system auditing purpose can somebody guide me how can I get the details when... (6 Replies)
Discussion started by: sukhvinder_Tm
6 Replies

6. UNIX for Dummies Questions & Answers

Panic kernal-mode address fault on user address 0x14

:) Firstly Hi all!!, im NEW!! and on here hoping that someone might be able to offer me some help... i have a server that keeps crashing every few days with the error message: PANIC KERNAL-MODE ADDRESS FAULT ON USER ADDRESS 0X14 KERNAL PAGE FAULT FROM (CS:EIP)=(100:EF71B5BD) EAX=EF822000... (10 Replies)
Discussion started by: Twix
10 Replies

7. Solaris

user logon details

how can i identifying whose are logged in last few days,time and date also want. what i will do for get that information (2 Replies)
Discussion started by: sijocg
2 Replies

8. UNIX for Dummies Questions & Answers

Script for parsing details in a log file to a seperate file

Hi Experts, Im a new bee for scripting, I would ned to do the following via linux shell scripting, I have an application which throws a log file, on each action of a particular work with the application, as sson as the action is done, the log file would vanish or stops updating there, the... (2 Replies)
Discussion started by: pingnagan
2 Replies

9. UNIX for Dummies Questions & Answers

logging SFTP details in a log file...

hi all..... i want to know how to log the details when logging into a server using SFTP......in FTP i used something like (ftp -uv<xxx.srp>>log_file.log) where the details will be logged to log_file...is there any options for doing the same in SFTP....i wanted to display the details abt... (4 Replies)
Discussion started by: santy
4 Replies

10. Shell Programming and Scripting

Read relevent details from Log File

Hi All, We have requirement to read XML details from large Log File and save in new file name. I have enclosed the sample xml which has start tag <OUTBOUND_MESSAGE xmlns="http://www.abc.com"> and the end tag as </OUTBOUND_MESSAGE> The log file contains many lines with other details which... (6 Replies)
Discussion started by: thinakarmani
6 Replies
Login or Register to Ask a Question