Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Append file with grep output but add timestamp? Post 302328775 by vgersh99 on Thursday 25th of June 2009 07:48:05 AM
Old 06-25-2009
Code:
grep "monkey" zoo.log | tail -1 | sed "s/^/$(date)/" >> cron-zoo-log

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Append output to file

Hi, I have a script below. It get's the data from the output of a script that is running hourly. My problem is every time my script runs, it deletes the previous data and put the current data. Please see output below. What I would like to do is to have the hourly output to be appended on the... (3 Replies)
Discussion started by: ayhanne
3 Replies

2. Shell Programming and Scripting

Append Output to another file in Perl

Hi All, I am writing a Perl script such that the output from "perl myscript.pl file1" to be appended to another file name called file2. I tried out with the below code but couldn't work. Can any expert give me some advice? open(OUTPUT, 'perl myscript.pl file1 |'); close OUTPUT;... (7 Replies)
Discussion started by: Raynon
7 Replies

3. AIX

how to grep and compare timestamp in a file with the current date

I want to read a log file from a particular location.In the logfile , lines contains timestamp.I need to compare the timestamp in the logfile with the current date.If the timpestamp in the log file is less than 4 hours then i need to read the file from that location.Below is the file format.Please... (1 Reply)
Discussion started by: achu
1 Replies

4. AIX

how to grep and compare timestamp in a file with the current date

I want to read a log file from a particular location.In the log file each line starts with timestamp.I need to compare the timestamp in the logfile with the current date.If the timpestamp in the log file is less than 4 hours then i need to read the file from that location.Below is the file... (1 Reply)
Discussion started by: achu
1 Replies

5. UNIX for Dummies Questions & Answers

Output to file but append rather than overwrite?

I am running a command which has a parameter that outputs the results to a file each time it is run. Here is the command: --fullresult=true > importlog.xml Can I add the output to the file rather than creating a new one which overwrites the existing one? If not can I make the file name... (2 Replies)
Discussion started by: Sepia
2 Replies

6. Shell Programming and Scripting

append an output file with two columns

Hi All, can you help me with this: grep XXX dir/*.txt|wc -l > newfile.txt - this put the results in the newfile.txt, but I want to add another column in the newfile.txt, string 'YYYYY', separated somehow, which corresponds on the grep results? For example grep will grep XXX dir/*.txt|wc -l >... (5 Replies)
Discussion started by: apenkov
5 Replies

7. Shell Programming and Scripting

How to append timestamp in the filenames using find?

Hi, How to change the filenames with timestamp in sub folders I have the following code to select the records. find . -type f -name '*pqr*' -ctime 1 -print The following is the example app_root_dir="/`echo $ScriptDir | cut -d'/' -f2`" $app_root_dir/../BadFiles directory uvw.bad... (3 Replies)
Discussion started by: bobbygsk
3 Replies

8. Shell Programming and Scripting

Append timestamp create .trg file for all content of an unzipped archive

Hi, I have a test.zip archive that contains test.zip --> (file_1.txt, file_2.txt , file_3.txt) I need to unzip the file like this, file_1_timestamp.txt file_1_timestamp.trg file_2_timestamp.txt file_2_timestamp.trg file_3_timestamp.txt file_3_timestamp.trg Could you please let me know... (7 Replies)
Discussion started by: Shandel
7 Replies

9. Shell Programming and Scripting

Append to a file repeating output

Hello, i'm trying to force a command to read every second from an interface watch -n1 (command) /dev/x | cat >> output but it continue to overwrite the file, without append the content Thanks and advace for help as usual regards (4 Replies)
Discussion started by: Board27
4 Replies

10. Shell Programming and Scripting

Grep lines between last hour timestamp and current timestamp

So basically I have a log file and each line in this log file starts with a timestamp: MON DD HH:MM:SS SEP 15 07:30:01 I need to grep all the lines between last hour timestamp and current timestamp. Then these lines will be moved to a tmp file from which I will grep for particular strings. ... (1 Reply)
Discussion started by: nms
1 Replies
FIZ(1)							      General Commands Manual							    FIZ(1)

NAME
fiz - analyze damaged zoo archive for data recovery SYNOPSIS
fiz archive[.zoo] DESCRIPTION
Fiz is used to analyze damaged zoo archives and locate directory entries and file data in them. The current version of fiz is 2.0 and it is meant to be used in conjunction with zoo version 2.0. Fiz makes no assumptions about archive structure. Instead, it simply searches the entire subject archive for tag values that mark the locations of directory entries and file data. In a zoo archive, a directory entry contains information about a stored file such as its name, whether compressed or not, and its timestamp. The file data are the actual data for the archived file, and may be either the original data, or the result of compressing the file. For each directory entry found, fiz prints where in the archive it is located, the directory path and filename(s) found in it, whether the directory entry appears to be corrupted (indicated by [*CRC Error*]), and the value of the pointer to the file data that is found in the directory entry. For each block of file data found in the archive, fiz prints where in the archive the block begins. In the case of an undamaged archive, the pointer to file data found in a directory entry will correspond to where fiz actually locates the data. Here is some sample output from fiz: **************** 2526: DIR [changes] ==> 95 2587: DATA **************** 3909: DIR [copyrite] ==> 1478 3970: DATA 4769: DATA **************** In such output, DIR indicates where fiz found a directory entry in the archive, and DATA indicates where fiz found file data in the ar- chive. Filenames located by fiz are enclosed in square brackets, and the notation "==> 95" indicates that the directory entry found by fiz at position 2526 has a file data pointer to position 95. In actuality, fiz found file data at positions 2587, 3970, and 4769. Since fiz found only two directory entries, and each directory entry corresponds to one file, one of the file data positions is an artifact. Once the locations of directory entries and file data are found, the @ modifier to zoo's archive list and extract commands can be used and the archive contents selectively listed or extracted, skipping the damaged portion. This is further described in the documentation for zoo(1). In the above case, commands to try giving to zoo might be x@2526,2587 (extract beginning at position 2526, and get file data from position 2587), x@3090,3970 (extract at 3090, get data from 3970) and x@3909,4769 (extract at 3909, get data from 4769). Once a correctly-matched directory entry/file data pair is found, zoo will in most cases synchronize with and correctly extract all files subsequently found in the archive. Trial and error should allow all undamaged files to be extracted. Also note that self-extracting archives created using sez (the Self-Extracting Zoo utility for MS-DOS), which are normally executed on an MS-DOS system for extraction, can be extracted on non-MSDOS sys- tems in a similar way. SEE ALSO
zoo(1) BUGS
Random byte patterns can occasionally be incorrectly recognized as tag values. This occurs very rarely, however, and trial and error will usually permit all undamaged data to be extracted. DIAGNOSTICS
Fiz always exits with a status code of 0. FUTURE DIRECTIONS
Automation of data recovery from a damaged archive is potentially achievable. However, since damaged archives occur only rarely, fiz as it currently stands is unlikely to change much in the near future. AUTHOR
Rahul Dhesi Jan 31, 1988 FIZ(1)
All times are GMT -4. The time now is 11:04 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy