01-18-2015
It is part of to the POSIX specification. And so this will work fine with those older and compliant seds (and even seds that are older than that) .... So the assertion in #3 is inaccurate and I do not share this "good style and safe" opinion. It is immediately clear that the first asterisk cannot be anything other than literal, unless one assumes a mistake, which is not the case..
Last edited by Scrutinizer; 01-19-2015 at 12:17 AM..
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi
I need to search for matching strings in a database and I want to print out all files that matches in "detail", which means that I want the output to contain datum of last saving. I only get the grep function tp print the actual file names which is not enough since the database is to large... (14 Replies)
Discussion started by: slire
14 Replies
2. Shell Programming and Scripting
Hi everybody! :) :D :D :)
it's great to be here since this is my first post.
touch /base/oracle/FRA/XMUT00/RMAN_FLAG
touch /base/oracle/FRA/XRLL00/RMAN_FLAG
find directory name containing RMAN_FLAG :
$ find /base/oracle/FRA -name RMAN_FLAG -print|xargs -n1 dirname |sort -u... (3 Replies)
Discussion started by: jolan_louve
3 Replies
3. Shell Programming and Scripting
hi all,
for an example:
In a file out.txt contains:
/export/home/raghu/bin/debug_serverLog_apache_20090626_0625.txt
How to grep or cut the value as "debug_serverLog_apache_20090626_0625.txt"
or i want only the output as "debug_serverLog_apache_20090626_0625.txt"
pls advice me (3 Replies)
Discussion started by: raghur77
3 Replies
4. UNIX for Dummies Questions & Answers
I have multiple systems with each having its own log directory containing log file pertinent to that system. I have constructed a find/grep statement to get the list of directories ending in log, but I can't seem to pipe that to grep (via xargs) to have grep search each file in the log directories... (8 Replies)
Discussion started by: jmgibby
8 Replies
5. Shell Programming and Scripting
Hi,
I want to grep a string from the list of files present in a text file.
I want the output to be printed only when the string is present in a file along with the file name..
I tried some thing like
cat files_list | grep "search_string" $_
I know $_ is wrong but i want something... (7 Replies)
Discussion started by: nigas
7 Replies
6. UNIX for Dummies Questions & Answers
Hi,
My requirement is to copy all yesterdays files which have "access" keyword in their filenames to a separate folder say "/tmp/moht".
Can you please let me know how? (8 Replies)
Discussion started by: shifahim
8 Replies
7. UNIX for Dummies Questions & Answers
Hi all,
it possible creating a file with list of directories, and using grep to find pattern on only directories and subdirectories contained in that file?
And it is done?
regards (4 Replies)
Discussion started by: bspirit
4 Replies
8. Shell Programming and Scripting
I have a script to create a variable from a list, B.txt and then search it in another file, file.txt and then print the pattern line and next line.
#!/bin/bash
while read a
do
echo "$a" | grep -A 1 $a file.txt > $a\.txt
done < B.txt
I always get that no such file or directory exists... (6 Replies)
Discussion started by: godzilla07
6 Replies
9. Shell Programming and Scripting
cat /tmp/i.txt
'(ORA-28001|ORA-00100|ORA-28001|ORA-20026|ORA-20025|ORA-02291|ORA-01458|ORA-01017|ORA-1017|ORA-28000|ORA-06512|ORA-06512|Domestic Phone|ENCRYPTION)'
grep -ia 'ORA-\{5\}:' Rep* |grep -iavE `cat /tmp/i.txt`
grep: Unmatched ( or \(
Please tell me why am i getting that (6 Replies)
Discussion started by: jhonnyrip
6 Replies
10. Shell Programming and Scripting
Hi
I have below lists of files
filename-1.0.0.tar.gz
filename-1.0.1.345657676.snapshots.tar.gz
so when I do grep -o 'filename-*.tar.gz' | sort | tail -1
then it consider snapshots as a part of it's result.
How can I make sure, that it should only display the results from... (3 Replies)
Discussion started by: manas_ranjan
3 Replies
LEARN ABOUT NETBSD
posix2time
TIME2POSIX(3) BSD Library Functions Manual TIME2POSIX(3)
NAME
time2posix, time2posix_z, posix2time, posix2time_z, -- convert seconds since the Epoch
LIBRARY
Standard C Library (libc, -lc)
SYNOPSIS
#include <time.h>
time_t
time2posix(time_t t);
time_t
time2posix_z(const timezone_t tz, time_t t);
time_t
posix2time(time_t t);
time_t
posix2time_z(const timezone_t tz, time_t t);
DESCRIPTION
IEEE Std 1003.1 (``POSIX.1'') legislates that a time_t value of 536457599 shall correspond to
Wed Dec 31 23:59:59 UTC 1986.
This effectively implies that POSIX time_t's cannot include leap seconds and, therefore, that the system time must be adjusted as each leap
occurs.
If the time package is configured with leap-second support enabled, however, no such adjustment is needed and time_t values continue to
increase over leap events (as a true `seconds since...' value). This means that these values will differ from those required by POSIX by the
net number of leap seconds inserted since the Epoch.
Typically this is not a problem as the type time_t is intended to be (mostly) opaque -- time_t values should only be obtained-from and
passed-to functions such as time(3), localtime(3), localtime_r(3), localtime_rz(3), mktime(3), mktime_z(3), and difftime(3). However, POSIX
gives an arithmetic expression for directly computing a time_t value from a given date/time, and the same relationship is assumed by some
(usually older) applications. Any programs creating/dissecting time_t's using such a relationship will typically not handle intervals over
leap seconds correctly.
The time2posix(), time2posix_z(), posix2time(), and posix2time_z() functions are provided to address this time_t mismatch by converting
between local time_t values and their POSIX equivalents. This is done by accounting for the number of time-base changes that would have
taken place on a POSIX system as leap seconds were inserted or deleted. These converted values can then be used in lieu of correcting the
older applications, or when communicating with POSIX-compliant systems.
time2posix() and time2posix_z() are single-valued. That is, every local time_t corresponds to a single POSIX time_t. posix2time() and
posix2time() are less well-behaved: for a positive leap second hit the result is not unique, and for a negative leap second hit the corre-
sponding POSIX time_t doesn't exist so an adjacent value is returned. Both of these are good indicators of the inferiority of the POSIX rep-
resentation.
The ``z'' variants of the two functions behave exactly like their counterparts, but they operate in the given tz argument which was previ-
ously allocated using tzalloc(3) and are re-entrant.
The following table summarizes the relationship between a time_t and its conversion to, and back from, the POSIX representation over the leap
second inserted at the end of June, 1993.
DATE TIME T X=time2posix(T) posix2time(X)
93/06/30 23:59:59 A+0 B+0 A+0
93/06/30 23:59:60 A+1 B+1 A+1 or A+2
93/07/01 00:00:00 A+2 B+1 A+1 or A+2
93/07/01 00:00:01 A+3 B+2 A+3
A leap second deletion would look like...
DATE TIME T X=time2posix(T) posix2time(X)
??/06/30 23:59:58 A+0 B+0 A+0
??/07/01 00:00:00 A+1 B+2 A+1
??/07/01 00:00:01 A+2 B+3 A+2
[Note: posix2time(B+1) => A+0 or A+1]
If leap-second support is not enabled, local time_t's and POSIX time_t's are equivalent, and both time2posix() and posix2time() degenerate to
the identity function.
SEE ALSO
difftime(3), localtime(3), localtime_r(3), localtime_rz(3), mktime(3), mktime_z(3), time(3), tzalloc(3)
BSD
December 4, 2010 BSD