A correction required because of a typo in the second script offerrin:-
For the output statement, it should read
I had missed the };${ out between day_of_month and month and it threw a wobbler.
Correcting it and running against your sample data gave me:-
Is that near to what is required? It looks rather messy to me, probably because the input has lots of extra spaces in it. If this represents all of the input from crontab -l then you will need to recode my suggestion to cater for that. It is picking up the date bit okay, but the next "field" I'm calling f1 is selected as just (. then f2 gets .profile and f3 is ; which makes no sense.
I need to insert data into a perticular field of a csv file, lets say second field.
Can any one help me to do this?
I found that we can do it with sed. can any one guide me to accomplish this?
thanks in advance. (12 Replies)
Hi,
I am working right now with a csv file and I want to insert an excel formula say to the 6th column.
sample csv file:
1234,lag,0,77,544,,7
1234,lag,222,0,7,,7
at first i used a simple command:
sed 's/^\(.\{17\}\)/\1word/' file.csv
but the result is this:
... (2 Replies)
Dear All,
once again I am encountering a problem with awk.
The file looks like this:
BroadLeaves 43.6 clc2006 37.6 Conifers 8.3 edge100 5.1 dem30sec 3.9 aspect 1.5 slope 0
dem30sec 58.3 Conifers 28.5 clc2006 7.3 edge100 3 slope 2.4 BroadLeaves 0.4 aspect 0.1
....
...
..
My... (9 Replies)
I have a CSV file with a variable number of fields per record. How do I print lines of a certain number of fields only? Several permutations of the following (including the use of escape characters) have failed to retrieve the line I'm after (1,2,3,4)...
$ cat myfile
1,2,3,4
1,2,3
$ # Print... (1 Reply)
Hi,
I have a requirment where I need to pull different columns from a .csv file.
Here is the sample of the csv file.
account,item,flag1,flag2,flag3,flag4,flag5,......feed,tran
I will be have a config.txt file which will have the following information.
item,flag5,flag10,feed,tran... (2 Replies)
Attached is a file called diff.txt
It is the output from this command:
diff -y --suppress-common-lines --width=5000 1.txt 2.txt > diff.txt
I have also attached 1.txt and 2.txt for your convenience.
Both 1.txt and 2.txt contain one very long CSV string.
File 1.txt is a CSV dump of... (0 Replies)
hi
I have a csv file with few rows
> cat job_stat
1,jobname1,somthing,somthing
2,jobname2,somthing,somthing
3,jobname3,somthing,somthing
4,jobname4,somthing,somthing
I want to add few columns after the 2nd column and then append rest of the columns after the 3rd newly added... (3 Replies)
Hi experts,
I have a csv file which has one field (ID) repeated multiple times with corresponding other field values.
I need to convert this file in a format where for a ID all other values has to be present in single field.
For Eg : Here in below file ID 1 is repeated 3 times with different... (7 Replies)
I have a csv file which is produced out of a SED command sed 's/|/","/g; s/^/"/; s/$/"/' A4.txt > A5.csv and I need either an addition to the SED command or a separate command to convert the following characters which occur within the fields in multiple lines
1) "=" to ="
and
2)""~ to " (4 Replies)
can anyone help me!!!! How to I parse the CSV file
file name : abc.csv (csv file) The above file containing data like
abv,sfs,,hju,',',jkk wff,fst,,rgr,',',rgr ere,edf,erg,',',rgr,rgr I have a requirement like i have to extract different field and assign them into different... (4 Replies)
Discussion started by: J.Jena
4 Replies
LEARN ABOUT OSX
rotatelogs
ROTATELOGS(8) rotatelogs ROTATELOGS(8)NAME
rotatelogs - Piped logging program to rotate Apache logs
SYNOPSIS
rotatelogs [ -l ] [ -f ] logfile rotationtime|filesizeM [ offset ]
SUMMARY
rotatelogs is a simple program for use in conjunction with Apache's piped logfile feature. It supports rotation based on a time interval or
maximum size of the log.
OPTIONS -l Causes the use of local time rather than GMT as the base for the interval or for strftime(3) formatting with size-based rotation.
Note that using -l in an environment which changes the GMT offset (such as for BST or DST) can lead to unpredictable results!
-f Causes the logfile to be opened immediately, as soon as rotatelogs starts, instead of waiting for the first logfile entry to be read
(for non-busy sites, there may be a substantial delay between when the server is started and when the first request is handled,
meaning that the associated logfile does not "exist" until then, which causes problems from some automated logging tools). Available
in version 2.2.9 and later.
logfile
rotationtime
The time between log file rotations in seconds. The rotation occurs at the beginning of this interval. For example, if the rotation
time is 3600, the log file will be rotated at the beginning of every hour; if the rotation time is 86400, the log file will be
rotated every night at midnight. (If no data is logged during an interval, no file will be created.)
filesizeM
The maximum file size in megabytes followed by the letter M to specify size rather than time.
offset The number of minutes offset from UTC. If omitted, zero is assumed and UTC is used. For example, to use local time in the zone UTC
-5 hours, specify a value of -300 for this argument. In most cases, -l should be used instead of specifying an offset.
EXAMPLES
CustomLog "|bin/rotatelogs /var/logs/logfile 86400" common
This creates the files /var/logs/logfile.nnnn where nnnn is the system time at which the log nominally starts (this time will always be a
multiple of the rotation time, so you can synchronize cron scripts with it). At the end of each rotation time (here after 24 hours) a new
log is started.
CustomLog "|bin/rotatelogs -l /var/logs/logfile.%Y.%m.%d 86400" common
This creates the files /var/logs/logfile.yyyy.mm.dd where yyyy is the year, mm is the month, and dd is the day of the month. Logging will
switch to a new file every day at midnight, local time.
CustomLog "|bin/rotatelogs /var/logs/logfile 5M" common
This configuration will rotate the logfile whenever it reaches a size of 5 megabytes.
ErrorLog "|bin/rotatelogs /var/logs/errorlog.%Y-%m-%d-%H_%M_%S 5M"
This configuration will rotate the error logfile whenever it reaches a size of 5 megabytes, and the suffix to the logfile name will be cre-
ated of the form errorlog.YYYY-mm-dd-HH_MM_SS.
PORTABILITY
The following logfile format string substitutions should be supported by all strftime(3) implementations, see the strftime(3) man page for
library-specific extensions.
o %A - full weekday name (localized)
o %a - 3-character weekday name (localized)
o %B - full month name (localized)
o %b - 3-character month name (localized)
o %c - date and time (localized)
o %d - 2-digit day of month
o %H - 2-digit hour (24 hour clock)
o %I - 2-digit hour (12 hour clock)
o %j - 3-digit day of year
o %M - 2-digit minute
o %m - 2-digit month
o %p - am/pm of 12 hour clock (localized)
o %S - 2-digit second
o %U - 2-digit week of year (Sunday first day of week)
o %W - 2-digit week of year (Monday first day of week)
o %w - 1-digit weekday (Sunday first day of week)
o %X - time (localized)
o %x - date (localized)
o %Y - 4-digit year
o %y - 2-digit year
o %Z - time zone name
o %% - literal `%'
Apache HTTP Server 2010-11-06 ROTATELOGS(8)