Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Advise to print lines before and after patterh match and checking and removing duplicate files Post 303046169 by newbie_01 on Sunday 26th of April 2020 08:43:24 AM
Old 04-26-2020
Hi Rudic


Your suggestion is really cool, it does like what you said where it skips the ones that has been parsed before as per the filesdone control file. I tested it and rename one of the file and re-run the same awk and it only does the one that it has not work on before.



It works on Linux but not on Solaris. On Solaris it gives error


Code:
grep: illegal option -- f
Usage: grep [-c|-l|-q] -bhinsvw pattern file . . .
awk: syntax error near line 9
awk: bailing out near line 9


I also tried using /usr/xpg4/bin/grep


Code:
awk: syntax error near line 9
awk: bailing out near line 9


The only problem with this approach is that while most of the alert_${sid}* are final, one of them isn't. So there will be several alert_${sid}.log.YYYYMMDDHHMM and one current log that is named alert_${sid}.log. So
Code:
$(ls $DIR_PATH/alert_${sid}* | grep -vf filesdone) /dev/null

should parse the others once but should always be parsing alert_${sid}.log. If such is the case, then the search for the current log may or may not always be a duplicate since the CORRUPT string may or may not appear. Not sure if am explaining it correctly, sorry Smilie
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Removing duplicate lines ignore case

hi, I have the following input in file: abc ab a AB b c a C B When I use uniq -u file,the out put file is: abc ab AB c v B C (17 Replies)
Discussion started by: hellsd
17 Replies

2. UNIX for Dummies Questions & Answers

removing duplicate lines from a file

Hi, I am trying to remove duplicate lines from a file. For example the contents of example.txt is: this is a test 2342 this is a test 34343 this is a test 43434 and i want to remove the "this is a test" lines only and end up with the numbers in the file, that is, end up with: 2342... (4 Replies)
Discussion started by: ocelot
4 Replies

3. Shell Programming and Scripting

removing duplicate blank lines

Hi, how to remove the blank lines from the file only If we have more than one blank line. thanks rameez (8 Replies)
Discussion started by: rameezrajas
8 Replies

4. Shell Programming and Scripting

removing the duplicate lines in a file

Hi, I need to concatenate three files in to one destination file.In this if some duplicate data occurs it should be deleted. eg: file1: ----- data1 value1 data2 value2 data3 value3 file2: ----- data1 value1 data4 value4 data5 value5 file3: ----- data1 value1 data4 value4 (3 Replies)
Discussion started by: Sharmila_P
3 Replies

5. Shell Programming and Scripting

Removing duplicates from string (not duplicate lines)

please help me in getting following: Input Desired output x="foo" foo x="foo foo" foo x="foo foo" foo x="foo abc foo" foo abc x="foo foo1 foo2" foo foo1 foo2 I need to remove duplicated from string.. (8 Replies)
Discussion started by: vickylife
8 Replies

6. Shell Programming and Scripting

Removing Duplicate Lines per Section

Hello, I am in need of removing duplicate lines from within a file per section. File: ABC1 012345 header ABC2 7890-000 ABC3 012345 Header Table ABC4 ABC5 593.0000 587.4800 ABC5 593.5000 587.6580 <= dup need to remove ABC5 593.5000 ... (5 Replies)
Discussion started by: petersf
5 Replies

7. Shell Programming and Scripting

removing duplicate lines while maintaing coherence with second file

So I have two files. The first file, file1.txt, has lines of numbers separated by commas. file1.txt 10,2,30,50 22,6,3,15,16,100 73,55 78,40,33,30,11 73,55 99,82,85 22,6,3,15,16,100 The second file, file2.txt, has sentences. file2.txt "the cat is fat" "I like eggs" "fish live in... (6 Replies)
Discussion started by: adrunknarwhal
6 Replies

8. Shell Programming and Scripting

Removing a block of duplicate lines from a file

Hi all, I have a file with the data 1 abc 2 123 3 ; 4 rao 5 bell 6 ; 7 call 8 abc 9 123 10 ; 11 rao 12 bell 13 ; (10 Replies)
Discussion started by: raosr020
10 Replies

9. UNIX for Dummies Questions & Answers

Removing a set of Duplicate lines from a file

Hi, How do i remove a set of duplicate lines from a file. My file contains the lines: abc def ghi abc def ghi jkl mno pqr jkl mno (1 Reply)
Discussion started by: raosr020
1 Replies

10. UNIX for Beginners Questions & Answers

Advise on how to print range of lines above and below a number?

Hi, I have attached an output file which is some kind of database file mapping. It is basically like an allocation mapping of a tablespace and its datafile/s. The output is generated by the SQL script that I found from 401 Authorization Required Excerpts of the file are as below: ... (2 Replies)
Discussion started by: newbie_01
2 Replies
sccs-delta(1)							   User Commands						     sccs-delta(1)

NAME
sccs-delta, delta - make a delta to an SCCS file SYNOPSIS
/usr/ccs/bin/delta [-dnps] [-g sid-list | -gsid-list] [-m mr-list | -mmr-list] [-r sid | -rsid] [ -y [comment]] s.filename... /usr/xpg4/bin/delta [-dnps] [-g sid-list | -gsid-list] [-m mr-list | -mmr-list] [-r sid | -rsid] [ -y [comment]] s.filename... DESCRIPTION
The delta utility checks in a record of the line-by-line differences made to a checked-out version of a file under SCCS control. These changes are taken from the writable working copy that was retrieved using the SCCS get command (see sccs-get(1)). This working copy does not have the `s.' prefix, and is also referred to as a g-file. If a directory name is used in place of the s.filename argument, the delta command applies to all s.files in that directory. Unreadable s.files produce an error; processing continues with the next file (if any). The use of `-' as the s.filename argument indicates that the names of files are to be read from the standard input, one s.file per line (requires -y, and in some cases, -m). delta may issue prompts on the standard output depending upon the options specified and the flags that are set in the s.file (see sccs- admin(1), and the -m and -y options below, for details). /usr/xpg4/bin/delta The SID of the delta is not echoed to stdout. OPTIONS
The following options are supported: -d Use command diff(1) instead of bdiff(1). Returns exit status 2 if s.filename argument is not specified. -n Retain the edited g-file, which is normally removed at the completion of processing. -p Display line-by-line differences (in diff(1) format) on the standard output. -s Silent. Do not display warning or confirmation messages. Do not suppress error messages (which are writ- ten to standard error). -g sid-list | -gsid-list Specify a list of deltas to omit when the file is accessed at the SCCS version ID (SID) created by this delta. sid-list is a comma-separated list of SIDs. To specify a range of deltas, use a `-' separator instead of a comma, between two SIDs in the list. -m mr-list | -mmr-list If the SCCS file has the v flag set (see sccs-admin(1)), you must supply one or more Modification Request (MR) numbers for the new delta. When specifying more than one MR number on the command line, mr-list takes the form of a quoted, space-separated list. If -m is not used and the standard input is a terminal, delta prompts with MRs? for the list (before issuing the comments? prompt). If the v flag in the s.file has a value, it is taken to be the name of a program to validate the MR numbers. If that validation program returns a non-zero exit status, delta terminates without checking in the changes. -r sid | -rsid When two or more versions are checked out, specify the version to check in. This SID value can be either the SID specified on the get command line, or the SID of the new version to be checked in as reported by get. A diagnostic results if the specified SID is ambiguous, or if one is required but not supplied. -y[comment] Supply a comment for the delta table (version log). A null comment is accepted, and produces an empty com- mentary in the log. If -y is not specified and the standard input is a terminal, delta prompts with `com- ments?'. An unescaped NEWLINE terminates the comment. ENVIRONMENT VARIABLES
See environ(5) for descriptions of the following environment variables that affect the execution of delta: LANG, LC_ALL, LC_COLLATE, LC_CTYPE, LC_MESSAGES, and NLSPATH. EXIT STATUS
The following exit values are returned: 0 Successful completion. 1 An error occurred and the -d option had not been specified. 2 An error occurred, the -d option had been specified, and the s.filename argument was not specified. FILES
d.file temporary file of differences p.file lock file for a checked-out version q.file temporary file s.file SCCS history file x.file temporary copy of the s.file z.file temporary file ATTRIBUTES
See attributes(5) for descriptions of the following attributes: /usr/ccs/bin/delta +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWsprot | +-----------------------------+-----------------------------+ /usr/xpg4/bin/delta +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWxcu4t | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ SEE ALSO
bdiff(1), diff(1), sccs-admin(1), sccs-cdc(1), sccs-get(1), sccs-help(1), sccs-prs(1), sccs-prt(1), sccs-rmdel(1), sccs-sccsdiff(1), sccs- unget(1), sccs(1), what(1), sccsfile(4), attributes(5), environ(5), standards(5) DIAGNOSTICS
Use the SCCS help command for explanations (see sccs-help(1)). WARNINGS
Lines beginning with an ASCII SOH character (binary 001) cannot be placed in the SCCS file unless the SOH is escaped. This character has special meaning to SCCS (see sccsfile(4)) and produces an error. SunOS 5.10 1 Nov 1999 sccs-delta(1)
All times are GMT -4. The time now is 07:57 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy