Hi,
I have this following script below. Its searching a log file for 2 string and if found then write the strings to success.txt and If not found write strings to failed.txt . if one found and not other...then write found to success.txt and not found to failed.txt.
I want to optimize this... (3 Replies)
can we optimize this command ?
sed 's#AAAA##g' /study/i.txt | sed '1,2d' | tr -d '\n\' > /study/i1.txt;
as here i am using two files ...its overhead..can we optimise to use only 1 file
sed 's#AAAA##g' /study/i.txt | sed '1,2d' | tr -d '\n\' > /study/i.txt;
keeping them same but it... (9 Replies)
#!/usr/bin/perl
use strict;
use warnings;
use Date::Manip;
my $date_converted = UnixDate(ParseDate("3 days ago"),"%e/%h/%Y");
open FILE,">$ARGV";
while(<DATA>){
my @tab_delimited_array = split(/\t/,$_);
$tab_delimited_array =~ s/^\ =~ s/^\-//;
my $converted_date =... (2 Replies)
Pl help to me to write the below code in a simple way ...
i suupose to use this code 3 to 4 places in my makefile(gnu) ..
****************************************
@for i in $(LIST_A); do \
for j in $(LIST_B); do\
if ;then\
echo "Need to sign"\
echo "List A = $$i , List B =$$j"\
... (2 Replies)
Hi,
I have to assign a value for a varaiable based on a Input. I have written the below code:
if
then
nf=65
elif
then
nf=46
elif
then
nf=164
elif
then
nf=545
elif
then
nf=56
elif
then (3 Replies)
Here is my code. What it does is it reads an input file (input.txt which contains roughly 2,000 search phrases) and searches a directory for files that contains the search phrase. The directory contains roughly 1900 files and 84 subdirectories. The output is a file (output.txt) that shows only the... (23 Replies)
Hello,
I'm wondering if there is a quicker way of doing this.
Here is my mv script.
d=/conversion/program/out
cd $d
ls $d > /home/tempuser/$$tmp
while read line ; do
a=`echo $line|cut -c1-5|sed "s/_//g"`
b=`echo $line|cut -c16-21`
if ;then mkdir... (13 Replies)
Hi guys,
I feel a bit comfortable now doing bash scripting but I am worried that the way I do it is not optimized and I can do much better as to how I code.
e.g.
I have a whole line in a file from which I want to extract some values.
Right now what I am doing is :
STATE=`cat... (5 Replies)
how can i optimize the following:
TOTALRESULT="total1=4
total2=9
total3=89
TMEMORY=1999"
TOTAL1=$(echo "${TOTALRESULT}" | egrep "total1=" | awk -F"=" '{print $NF}')
TOTAL2=$(echo "${TOTALRESULT}" | egrep "total2=" | awk -F"=" '{print $NF}')
TOTAL3=$(echo... (4 Replies)
Discussion started by: SkySmart
4 Replies
LEARN ABOUT PLAN9
ctime
CTIME(2) System Calls Manual CTIME(2)NAME
ctime, localtime, gmtime, asctime, timezone - convert date and time to ASCII
SYNOPSIS
#include <u.h>
#include <libc.h>
char* ctime(long clock)
Tm* localtime(long clock)
Tm* gmtime(long clock)
char* asctime(Tm *tm)
/env/timezone
DESCRIPTION
Ctime converts a time clock such as returned by time(2) into ASCII (sic) and returns a pointer to a 30-byte string in the following form.
All the fields have constant width.
Wed Aug 5 01:07:47 EST 1973
Localtime and gmtime return pointers to structures containing the broken-down time. Localtime corrects for the time zone and possible day-
light savings time; gmtime converts directly to GMT. Asctime converts a broken-down time to ASCII and returns a pointer to a 30-byte
string.
typedef
struct {
int sec; /* seconds (range 0..59) */
int min; /* minutes (0..59) */
int hour; /* hours (0..23) */
int mday; /* day of the month (1..31) */
int mon; /* month of the year (0..11) */
int year; /* year A.D. - 1900 */
int wday; /* day of week (0..6, Sunday = 0) */
int yday; /* day of year (0..365) */
char zone[4]; /* time zone name */
} Tm;
When local time is first requested, the program consults the timezone environment variable to determine the time zone and converts accord-
ingly. (This variable is set at system boot time by init(8).) The timezone variable contains the normal time zone name and its difference
from GMT in seconds followed by an alternate (daylight) time zone name and its difference followed by a newline. The remainder is a list
of pairs of times (seconds past the start of 1970, in the first time zone) when the alternate time zone applies. For example:
EST -18000 EDT -14400
9943200 25664400 41392800 57718800 ...
Greenwich Mean Time is represented by
GMT 0
SOURCE
/sys/src/libc/9sys
SEE ALSO date(1), time(2), init(8)BUGS
The return values point to static data whose content is overwritten by each call.
Daylight Savings Time is ``normal'' in the Southern hemisphere.
These routines are not equipped to handle non-ASCII text, and are provincial anyway.
CTIME(2)