Sponsored Content
Top Forums Shell Programming and Scripting Delete all files if another files in the same directory has a matching occurence of a specific word Post 302373209 by Scrutinizer on Thursday 19th of November 2009 06:14:52 PM
Old 11-19-2009
How about:
Code:
awk '/ShortName / && A[$0] { print FILENAME } {A[$0]=1}' infile* | xargs rm

you can use
Code:
| xargs echo rm

to see if the awk script has the desired result first.
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

delete files in specific directory

i have a directory "ABC" with lots of old files and sub directories in it. the issue now is i want to delete away files which are older than 15 days in "ABC" without deleting the files in the sub directories and without deleting the sub directory. i tried using find command but it will drill down... (2 Replies)
Discussion started by: legato
2 Replies

2. Shell Programming and Scripting

Delete all occurence of a word in one shot

i have a file called file1 cat file1 i am namish namish lives in India India and namish both are good. I want to delete all the occurences of namish in one shot,if i do it with sed i guess all the lines will be deleted containing the pattern.Suggest me any idea without AWK. Thanks... (6 Replies)
Discussion started by: namishtiwari
6 Replies

3. Shell Programming and Scripting

Find and replace a word in all the files (that contain the word) under a directory

Hi Everyone, I am looking for a simple way for replacing all the files under a directory that use the server "xsgd1234dap" with "xsdr3423pap". For Example: In the Directory, $pwd /home/nick $ grep -l "xsgd1234dap" *.sh | wc -l 119 I have "119" files that are still using... (5 Replies)
Discussion started by: filter
5 Replies

4. UNIX for Dummies Questions & Answers

List all files with sum of matching word

grep -c 'avihai' 1.log will give me count of 'avihai' in log I want to have a list of files in the folder that show file name with count side by side. Please advice (2 Replies)
Discussion started by: avihaimar
2 Replies

5. Shell Programming and Scripting

How to delete last occurence of word using Linux command?

Hi all, I am trying to delete last occurrence of word using sed command. for example. I have input like this on a.id1 = b.id1 and on a.id2 = b.id2 and on a.id3 = b.id3 and and I am expecting output like this on a.id1 = b.id1 and on a.id2 = b.id2 and on a.id3 = b.id3 I just need to... (11 Replies)
Discussion started by: nsk
11 Replies

6. Shell Programming and Scripting

Delete all files with specific extension in directory tree

I'm sure this has been asked many times, but a search didn't turn up a definitive best method for this (if there ever is such a thing). I have been using rsync to back up my main data directory, but I have accumulated a large number of older backups that I don't need. All of the files I don't... (14 Replies)
Discussion started by: LMHmedchem
14 Replies

7. Shell Programming and Scripting

Delete all files if another files in the same directory has a matching occurrence of a specific word

he following are the files available in my directory RSK_123_20141113_031500.txt RSK_123_20141113_081500.txt RSK_126_20141113_041500.txt RSK_126_20141113_081800.txt RSK_128_20141113_091600.txt Here, "RSK" is file prefix and 123 is a code name and rest is just timestamp of the file when its... (7 Replies)
Discussion started by: kridhick
7 Replies

8. Shell Programming and Scripting

Script needed to delete to the list of files in a directory based on last created & delete them

Hi My directory structure is as below. dir1, dir2, dir3 I have the list of files to be deleted in the below path as below. /staging/retain_for_2years/Cleanup/log $ ls -lrt total 0 drwxr-xr-x 2 nobody nobody 256 Mar 01 16:15 01-MAR-2015_SPDBS2 drwxr-xr-x 2 root ... (2 Replies)
Discussion started by: prasadn
2 Replies

9. Shell Programming and Scripting

How to delete all the files and folders inside all the directories except some specific directory?

hi, i have a requirement to delete all the files from all the directories except some specific directories like archive and log. for example: there are following directories such as A B C D Archive E Log F which contains some sub directories and files. The requirement is to delete all the... (7 Replies)
Discussion started by: Little
7 Replies
fs_wrapper(5)							File Formats Manual						     fs_wrapper(5)

NAME
fs_wrapper - configuration and binary files used by file system administration commands SYNOPSIS
FStype] ... FStype] ... FStype] ... FStype] ... FStype] ... FStype] ... FStype] ... FStype] ... FStype] ... FStype] ... FStype] ... DESCRIPTION
The commands listed in the SYNOPSIS can operate on different types of file systems. Each command (except for reads file system specific configuration files that control the command's behavior, and invokes a file system specific binary file to do the actual work. FStype is the file system type as optionally specified on the command line. If FStype is not given, then the file system type is determined from by matching an entry in this file with a device provided with the command (see individual commands for details of usage). Administrators may also define a default file system type for the above commands via the file If this file exists, and contains the line: (e.g., then the above commands will assume the FStype given in unless an FStype is provided on the command line or is in The default file system specification is provided to maintain compatibility with pre-10.0 invocations of the commands. See the FILES section for a list of the files used. WARNINGS
The configuration files are supplied by HP or by other file system vendors. They are not meant to be edited by System Administrators. Corruption or removal of these files may lead to strange behavior, including the inability to boot. The format of the configuration file is subject to change. The file system specific binary files are not normally executed directly. However, if the configuration files become unusable, direct exe- cution of these binary files may be a useful step in repairing and running the system again. The binary files accept the same arguments as the commands by which they are executed. The command is a special case. This command currently does not read a configuration file, and does not execute a file system specific binary file if FStype is or The binary that handles these FStypes also processes other FStypes and calls the file system specific command if appropriate. For historical reasons, the binary files also handle and so there are no separate binary files for the latter two file systems. The commands (except will not work if they are renamed, because they are symbolically linked to a single executable FILES
FStype is the file system type as optionally specified on the command line. command is the name of the command. File system specific binary files for the and commands. There may be additional file system specific binary files in this directory that are not associated with File system specific binary files for the remaining commands. There may also be other file system specific binary files in this directory that are not associated with Configuration files for each file system type. File in which the default file system type can be defined. If this file does not exist, there is no default file system type. Static information about the file systems SEE ALSO
ff(1M), fsck(1M), fsdb(1M), mkfs(1M), mount(1M), ncheck(1M), newfs(1M), quot(1M), quotacheck(1M), volcopy(1M), fstab(4). fs_wrapper(5)
All times are GMT -4. The time now is 08:51 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy