12-19-2008
Hi
This is the script for date conversion -
File test contains the entire text.
cat test | awk -F ' ' ' $0 ~ /Event Time/ { printf $6 "-"; if ($0 ~ /Nov/ ) printf "11"; if ($0 ~ /Dec/ ) printf "12";
if ($0 ~ /Jan/ ) printf "1"; if ($0 ~ /Feb/ ) printf "2"; if ($0 ~ /Mar/ ) printf "3";
if ($0 ~ /Apr/ ) printf "4";if ($0 ~ /May/ ) printf "5"; if ($0 ~ /Jun/ ) printf "6"; if ($0 ~ /Jul/ ) printf "7";
if ($0 ~ /Aug/ ) printf "8"; if ($0 ~ /Sep/ ) printf "9"; if ($0 ~ /Oct/ ) printf "10";
printf "-" $7; printf "-" $8; }' | awk -F ':' ' { print $1"-"$2; }' | sed -e 's/,//g'
Output of the prog is --
6-11-2008-08-41
Let me know if you expect the same or something else ..
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi,
I need to find out when a file has been created. 'ls -l' just lists the last date the file was modified. I have also noticed when viewing the attributes through NT, the last modified date is the same as the file creation date. I thought maybe this was a fault due to samba.
I guess what... (1 Reply)
Discussion started by: dpalmer
1 Replies
2. Linux
Could anyone help i have a question that i have a problem with for my home work it is,
How do i change file permissions in a command line enviromet
thanx (1 Reply)
Discussion started by: Cube3k
1 Replies
3. Programming
Hi to all,
I need in Microsoft C++ to IDENTIFY unix files
which are LINKS.
I use CFTPFILEFIND class.
Thanks
:-)
.:rolleyes: (0 Replies)
Discussion started by: mizrachi
0 Replies
4. Shell Programming and Scripting
I have an xml file.I want to change the value of some tag:
<WASConfig version='1.1'>
<JavaVirtualMachine>
<scope>
<server>
<hostNode>myAsNode</hostNode>
<name>myserver</name>
</server>
</scope>
<Settings>
<Setting>
... (5 Replies)
Discussion started by: javaholics
5 Replies
5. Shell Programming and Scripting
Hi,
I'm working on a script which has to copy multiple files from one server to another server. The list of files that are to be copied is present in a file say input.txt.
vi input.txt
abc.c
welcome.c
new.c
welcome1.c
for ftp'ing a single file say 'new.c' the following code... (2 Replies)
Discussion started by: i.srini89
2 Replies
6. Shell Programming and Scripting
I need to install a bin file in UNIX which requires user interaction for giving some information like user id , path, sid etc. All these information is stored in a properties file in the same location.
So if i give ./file.bin -f propfile.properties will it install the file taking all the... (1 Reply)
Discussion started by: coolmohere
1 Replies
7. Red Hat
Hi Linux Experts,
I am using RHEL 6.4, on checking I identified some files ends with the file attribute like dot (.) at the end. Whereas, I checked with the same level of other servers and I don't identify dot(.) at the end of file attribute. Why is it so? is there any meaning for it.
... (3 Replies)
Discussion started by: gsiva
3 Replies
8. UNIX for Dummies Questions & Answers
hi,
i am having a file which contains the below content, i need to take the word count of if and print the file name also
inputfile.txt
file_name1.txt,type_name1.txt
file_name2.txt,type_name2.txt
i would need the word count of the files like this
if file_name*.txt
then
wc -l... (10 Replies)
Discussion started by: rohit_shinez
10 Replies
9. Shell Programming and Scripting
Hi,
Below is my requirement
File1:
svasjsdhvassdvasdhhgvasddhvasdhasdjhvasdjsahvasdjvdasjdvvsadjhv
vdjvsdjasvdasdjbasdjbasdjhasbdasjhdbjheasbdasjdsajhbjasbjasbhddjb
svfsdhgvfdshgvfsdhfvsdadhfvsajhvasjdhvsajhdvsadjvhasjhdvjhsadjahs
File2:
sdh
hgv
I need a command such that... (8 Replies)
Discussion started by: imrandec85
8 Replies
10. Shell Programming and Scripting
Hi,
I am new to shell scripting and got a task to complete.
Task is : we have a log file where in i need to traverse through the whole file to check the string "Person Type missing in message" and after that i need to get EMPLID=xxxxxx from the file and print details in a different file.
... (1 Reply)
Discussion started by: suren424
1 Replies
LEARN ABOUT DEBIAN
explain_printf_or_die
explain_printf_or_die(3) Library Functions Manual explain_printf_or_die(3)
NAME
explain_printf_or_die - formatted output conversion and report errors
SYNOPSIS
#include <libexplain/printf.h>
int explain_printf_or_die(const char *format);
int explain_printf_on_error(const char *format);
DESCRIPTION
The explain_printf_or_die function is used to call the printf(3) system call. On failure an explanation will be printed to stderr, obtained
from the explain_printf(3) function, and then the process terminates by calling exit(EXIT_FAILURE).
The explain_printf_on_error function is used to call the printf(3) system call. On failure an explanation will be printed to stderr,
obtained from the explain_printf(3) function, but still returns to the caller.
format The format, exactly as to be passed to the printf(3) system call.
RETURN VALUE
The explain_printf_or_die function only returns on success, see printf(3) for more information. On failure, prints an explanation and
exits, it does not return.
The explain_printf_on_error function always returns the value return by the wrapped printf(3) system call.
EXAMPLE
The explain_printf_or_die function is intended to be used in a fashion similar to the following example:
int result = explain_printf_or_die(format);
SEE ALSO
printf(3)
formatted output conversion
explain_printf(3)
explain printf(3) errors
exit(2) terminate the calling process
COPYRIGHT
libexplain version 0.52
Copyright (C) 2010 Peter Miller
explain_printf_or_die(3)