Sponsored Content
Full Discussion: Need help with unix command
Top Forums Shell Programming and Scripting Need help with unix command Post 302484222 by saikiran_1984 on Thursday 30th of December 2010 07:25:38 AM
Old 12-30-2010
danmero,

please find below the input format.

2010-12-22 05:01:37 216.43.41.82 - 172.24.64.49 443 GET /images/blank_pixel.gif SMTRANSACTIONID=1b4019ac-06a8-4d118631-0d50-01b7156a 200 413 3137 0 Mozilla/4.0+(compatible;+MSIE+7.0;+Windows+NT+5.1;+InfoPath.2;+MS-RTC+LM+8)<EOL>
2010-12-22 05:01:37 216.43.41.82 - 172.24.64.49 443 GET /images/icon_preferences.gif SMTRANSACTIONID=1b4019ac-06a8-4d118631-07cc-02d00407 200 1447 3142 0 Mozilla/4.0+(compatible;+MSIE+7.0;+Windows+NT+5.1;+InfoPath.2;+MS-RTC+LM+8)<EOL>
2010-12-22 05:02:07 216.43.41.82 kroberson@icsco 172.24.64.49 443 GET /Jakarta/isapi_redirector2.dll SMTRANSACTIONID=1b4019ac-06a8-4d11864f-0c48-031f70f5 200 3351 3095 15 Mozilla/4.0+(compatible;+MSIE+7.0;+Windows+NT+5.1;+InfoPath.2;+MS-RTC+LM+8)
2010-12-22 05:04:36 216.43.41.82 kroberson@icsco 172.24.64.49 443 GET /Jakarta/isapi_redirector2.dll SMTRANSACTIONID=1b4019ac-06a8-4d1186e4-0b94-034027a3 200 1396 3138 0 Mozilla/4.0+(compatible;+MSIE+7.0;+Windows+NT+5.1;+InfoPath.2;+MS-RTC+LM+8)<EOL>
2010-12-22 05:05:37 216.43.41.82 kroberson@icsco 172.24.64.49 443 GET /Jakarta/isapi_redirector2.dll SMTRANSACTIONID=1b4019ac-06a8-4d118721-0b94-00fe2d34 200 1546 3138 0 Mozilla/4.0+(compatible;+MSIE+7.0;+Windows+NT+5.1;+InfoPath.2;+MS-RTC+LM+8)
<EOL>

every line int the log starts with date and timestamp. in the following format yyyy-mm-dd HH:MM:SS.

command should search for log entries between 05:02 (HH:MM) and 05:04 (HH:MM) including the starttime and endtime.( start time and end time can be any time in HH:MM format)

Please find below the output ( lines )

2010-12-22 05:02:07 216.43.41.82 kroberson@icsco 172.24.64.49 443 GET /Jakarta/isapi_redirector2.dll SMTRANSACTIONID=1b4019ac-06a8-4d11864f-0c48-031f70f5 200 3351 3095 15 Mozilla/4.0+(compatible;+MSIE+7.0;+Windows+NT+5.1;+InfoPath.2;+MS-RTC+LM+8) <EOL>
2010-12-22 05:04:36 216.43.41.82 kroberson@icsco 172.24.64.49 443 GET /Jakarta/isapi_redirector2.dll SMTRANSACTIONID=1b4019ac-06a8-4d1186e4-0b94-034027a3 200 1396 3138 0 Mozilla/4.0+(compatible;+MSIE+7.0;+Windows+NT+5.1;+InfoPath.2;+MS-RTC+LM+8)
<EOL>


Note: marked end of line in input and output format as <EOL>

let me know, if the example is not clear
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

wc command help.... and other unix command....... urgent

hi all. thanks for looking i am doing some homework. one question is that when type wc and then how to tell the program that we have finished entering data? also why do some operating systems report 22 as the number of bytes in the file above, while others only 20? thanks so much,... (1 Reply)
Discussion started by: dashi2k
1 Replies

2. Shell Programming and Scripting

How to use more than one MPE command STREAM with Unix command in a single shell?

Hello, I have problem in writing the shell script involving MPE command STREAM related to HP-UX and Unix command. Script is sh "nlshCMD 'STREAM <job name1>' | 'SHOWJOB' | grep $HPJOBNUM" sh "nlshCMD 'STREAM <job name2>' | 'SHOWJOB' | grep $HPJOBNUM" sh "nlshCMD 'STREAM <job name3>' |... (0 Replies)
Discussion started by: bosskr
0 Replies

3. HP-UX

How to use more than one MPE command STREAM with Unix command in a single shell?

Hello, I have problem in writing the shell script involving MPE command STREAM related to HP-UX and Unix command. Script is sh "nlshCMD 'STREAM <job name1>' | 'SHOWJOB' | grep $HPJOBNUM" sh "nlshCMD 'STREAM <job name2>' | 'SHOWJOB' | grep $HPJOBNUM" sh "nlshCMD 'STREAM <job name3>' |... (1 Reply)
Discussion started by: bosskr
1 Replies

4. Shell Programming and Scripting

assign a command line argument and a unix command to awk variables

Hi , I have a piece of code ...wherein I need to assign the following ... 1) A command line argument to a variable e.g origCount=ARGV 2) A unix command to a variable e.g result=`wc -l testFile.txt` in my awk shell script When I do this : print "origCount" origCount --> I get the... (0 Replies)
Discussion started by: sweta_doshi
0 Replies

5. UNIX for Advanced & Expert Users

unix command : how to insert text at the cursor location via command line?

Hi, Well my title isn't very clear I think. So to understand my goal: I have a script "test1" #!/bin/bash xvkbd -text blabla with xbindkeys, I bind F5 key in order it runs my test1 script So when I press F5, test1 runs. I'm under Emacs/Vi and I press F5 in order to have "blabla" be... (0 Replies)
Discussion started by: xib.be
0 Replies

6. UNIX for Dummies Questions & Answers

New to Unix command line and have a question about the "sort" command

I am going through the Unix Made Easy second edition book by John Muster. So far it's been very informative and I can tell it may be a bit out of date. In one of the exercises it talks about the "sort" command and using it to sort column's of data etc. The "sort" command has changed a bit and... (1 Reply)
Discussion started by: budfoxcat
1 Replies

7. UNIX Desktop Questions & Answers

Can Unix access Windows' File through Command Prompt in Unix

Hi all, I wish to know whether Unix can access window's file in Unix's terminal? Apart from that, how to copy files or share files between Window and Unix? I get to know of secure copy, however, my company's Unix does not support the feature of secure copy? Any other method for me to share/... (5 Replies)
Discussion started by: jessy83
5 Replies

8. Shell Programming and Scripting

Specify an entire UNIX command as a command line argument

I'm trying to write a bash script called YN that looks like the following YN "Specify a question" "doThis" "doThat" where "doThis" will be executed if the answer is "y", otherwise "doThat". For example YN "Do you want to list the file dog?" "ls -al dog" "" Here's my attempt... (3 Replies)
Discussion started by: LeoKSimon
3 Replies

9. Shell Programming and Scripting

UNIX command to copy files from Windows to UNIX box

Hi Folks, I have a file name abc.xml in my windows machine at the location c:\ytr\abc.xml which I want to place at the unix box machine inside cde directory.. at the following location that is /opt/app/cde/ now the credentials of unix box are abc345 -->(dummyid) ftyiu88--->(dummy passwd) ... (4 Replies)
Discussion started by: punpun66
4 Replies
TIMEDATECTL(1)							    timedatectl 						    TIMEDATECTL(1)

NAME
timedatectl - Control the system time and date SYNOPSIS
timedatectl [OPTIONS...] {COMMAND} DESCRIPTION
timedatectl may be used to query and change the system clock and its settings. Use systemd-firstboot(1) to initialize the system time zone for mounted (but not booted) system images. OPTIONS
The following options are understood: --no-ask-password Do not query the user for authentication for privileged operations. --adjust-system-clock If set-local-rtc is invoked and this option is passed, the system clock is synchronized from the RTC again, taking the new setting into account. Otherwise, the RTC is synchronized from the system clock. -H, --host= Execute the operation remotely. Specify a hostname, or a username and hostname separated by "@", to connect to. The hostname may optionally be suffixed by a container name, separated by ":", which connects directly to a specific container on the specified host. This will use SSH to talk to the remote machine manager instance. Container names may be enumerated with machinectl -H HOST. -M, --machine= Execute operation on a local container. Specify a container name to connect to. -h, --help Print a short help text and exit. --version Print a short version string and exit. --no-pager Do not pipe output into a pager. The following commands are understood: status Show current settings of the system clock and RTC, including whether network time synchronization through systemd-timesyncd.service is active. Even if it is inactive, a different service might still synchronize the clock. set-time [TIME] Set the system clock to the specified time. This will also update the RTC time accordingly. The time may be specified in the format "2012-10-30 18:17:16". set-timezone [TIMEZONE] Set the system time zone to the specified value. Available timezones can be listed with list-timezones. If the RTC is configured to be in the local time, this will also update the RTC time. This call will alter the /etc/localtime symlink. See localtime(5) for more information. list-timezones List available time zones, one per line. Entries from the list can be set as the system timezone with set-timezone. set-local-rtc [BOOL] Takes a boolean argument. If "0", the system is configured to maintain the RTC in universal time. If "1", it will maintain the RTC in local time instead. Note that maintaining the RTC in the local timezone is not fully supported and will create various problems with time zone changes and daylight saving adjustments. If at all possible, keep the RTC in UTC mode. Note that invoking this will also synchronize the RTC from the system clock, unless --adjust-system-clock is passed (see above). This command will change the 3rd line of /etc/adjtime, as documented in hwclock(8). set-ntp [BOOL] Takes a boolean argument. Controls whether network time synchronization is active and enabled (if available). This enables and starts, or disables and stops the systemd-timesyncd.service unit. It does not affect the state of any other, unrelated network time synchronization services that might be installed on the system. This command is hence mostly equivalent to: systemctl enable --now systemd-timesyncd.service and systemctl disable --now systemd-timesyncd.service, but is protected by a different access policy. Note that even if time synchronization is turned off with this command, another unrelated system service might still synchronize the clock with the network. Also note that, strictly speaking, systemd-timesyncd.service does more than just network time synchronization, as it ensures a monotonic clock on systems without RTC even if no network is available. See systemd-timesyncd.service(8) for details about this. EXIT STATUS
On success, 0 is returned, a non-zero failure code otherwise. ENVIRONMENT
$SYSTEMD_PAGER Pager to use when --no-pager is not given; overrides $PAGER. If neither $SYSTEMD_PAGER nor $PAGER are set, a set of well-known pager implementations are tried in turn, including less(1) and more(1), until one is found. If no pager implementation is discovered no pager is invoked. Setting this environment variable to an empty string or the value "cat" is equivalent to passing --no-pager. $SYSTEMD_LESS Override the options passed to less (by default "FRSXMK"). $SYSTEMD_LESSCHARSET Override the charset passed to less (by default "utf-8", if the invoking terminal is determined to be UTF-8 compatible). EXAMPLES
Show current settings: $ timedatectl Local time: Thu 2017-09-21 16:08:56 CEST Universal time: Thu 2017-09-21 14:08:56 UTC RTC time: Thu 2017-09-21 14:08:56 Time zone: Europe/Warsaw (CEST, +0200) System clock synchronized: yes systemd-timesyncd.service active: yes RTC in local TZ: no Enable network time synchronization: $ timedatectl set-ntp true ==== AUTHENTICATING FOR org.freedesktop.timedate1.set-ntp === Authentication is required to control whether network time synchronization shall be enabled. Authenticating as: user Password: ******** ==== AUTHENTICATION COMPLETE === $ systemctl status systemd-timesyncd.service systemd-timesyncd.service - Network Time Synchronization Loaded: loaded (/lib/systemd/system/systemd-timesyncd.service; enabled) Active: active (running) since Mo 2015-03-30 14:20:38 CEST; 5s ago Docs: man:systemd-timesyncd.service(8) Main PID: 595 (systemd-timesyn) Status: "Using Time Server 216.239.38.15:123 (time4.google.com)." CGroup: /system.slice/systemd-timesyncd.service 595 /lib/systemd/systemd-timesyncd ... SEE ALSO
systemd(1), hwclock(8), date(1), localtime(5), systemctl(1), systemd-timedated.service(8), systemd-timesyncd.service(8), systemd- firstboot(1) systemd 237 TIMEDATECTL(1)
All times are GMT -4. The time now is 02:13 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy