11-04-2015
If you know the file name, include it in the find command like -name filename.
9 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello all ( again )
I will like to search and replace string in text file
ok I can loop throw the files like :
foreach f ( ` find . -name "*."`)
.. but here I like to examine the file if in contain the desired string
and so do the sed -e 's/blah/foo/g' thingy on it or there is better way... (1 Reply)
Discussion started by: umen
1 Replies
2. Shell Programming and Scripting
Hi,
Am trying for a script which should delete more than 15 days older files in my current directory.Am using the below piece of code:
"find /tmp -type f -name "pattern" -mtime +15 -exec /usr/bin/ls -altr {} \;"
"find /tmp -type f -name "pattern" -mtime +15 -exec /usr/bin/rm -f {} \;"
... (9 Replies)
Discussion started by: puppala
9 Replies
3. UNIX for Dummies Questions & Answers
Could someone help me in recursive search and ftp'ing the files to remote server?
The host machine will have
/dir1/dira/list_of_files1
/dir1/dirb/list_of_files2
/dir1/dirc/list_of_files3
.
.
.
so., I need to search from dir1 recursively (only one level down) and find all the files that... (1 Reply)
Discussion started by: brahmi
1 Replies
4. UNIX for Advanced & Expert Users
I was working on a shell script and found that the find command took too long, especially when I had to execute it multiple times. After some thought and research I came up with two functions.
fileScan()
filescan will cd into a directory and perform any operations you would like from within... (8 Replies)
Discussion started by: newreverie
8 Replies
5. UNIX for Advanced & Expert Users
Hi all,
Since my gopher server doesn't like filenames containing 2 or more consecutive dots in a filename, I'd like to do a search for them and replace them with... well, let's say underscores...
I've tried a oneliner or 2 from other posts, but they don't seem to work well with locating dots.... (3 Replies)
Discussion started by: Evert
3 Replies
6. Shell Programming and Scripting
Hello again.
Well, I need help again sooner as I thought. Now I want to search for files with a known name within all subdirs, and copy the to differently named files in the same directory.
For example if I had only one file to copy, I would just usecp fileName newFileNamebut to do this... (1 Reply)
Discussion started by: cabaciucia
1 Replies
7. Shell Programming and Scripting
Objective:
Recursively search all files under a directory for SQL statements that end with ";"
Sample input:
UPDATE table1
set col=val
UPDATE table2
set cola=vala
,colb=valb;
UPDATE table3
set col=val
Expected output:
UPDATE table2
set cola=vala
,colb=valb; (1 Reply)
Discussion started by: krishmaths
1 Replies
8. UNIX for Dummies Questions & Answers
Hi All
I have a requirement to find the file that are most latest to be modified in each directory. Can somebody help with the command please?
E.g of the problem.
The directory A is having sub directory which are having subdirectory an so on.
I need a command which will find the... (2 Replies)
Discussion started by: sudeep.id
2 Replies
9. Shell Programming and Scripting
I'm trying to find folders created by a propritary data aquisition software with the .aps ending--yes, I have never encountered folder with a suffix before (some files also end in .aps) and sort them by date. I need the whole path
ls -dt "$dataDir"*".aps"does exactly what I want except for the... (2 Replies)
Discussion started by: Michael Stora
2 Replies
LEARN ABOUT REDHAT
lastcomm
LASTCOMM(1) General Commands Manual LASTCOMM(1)
NAME
lastcomm - print out information about previously executed commands.
SYNOPSIS
lastcomm
[ command-name ... ]
[ user-name ... ]
[ terminal-name ... ]
[ --strict-match ]
[ -f filename | --file filename ]
[ --user name ] [ --command name ] [ --tty name ]
[ --debug ] [ -V | --version ] [ -h | --help ]
DESCRIPTION
lastcomm prints out information about previously executed commands. If no arguments are specified, lastcomm will print info about all of
the commands in acct (the record file). If called with one or more of command-name, user-name, or terminal-name, only records containing
those items will be displayed. For example, to find out which users used command `a.out' and which users were logged into `tty0', type:
lastcomm a.out tty0
This will print any entry for which `a.out' or `tty0' matches in any of the record's fields (command, name, or terminal). If you want to
find only items that match *all* of the arguments on the command line, you must use the '-strict-match' option. For example, to list all
of the executions of command a.out by user root on terminal tty0, type:
lastcomm --strict-match a.out root tty0
The order of the arguments is not important.
For each entry the following information is printed:
+ command name of the process
+ flags, as recorded by the system accounting routines:
S -- command executed by super-user
F -- command executed after a fork but without a following exec
C -- command run in PDP-11 compatibility mode (VAX only)
D -- command terminated with the generation of a core file
X -- command was terminated with the signal SIGTERM
+ the name of the user who ran the process
+ time the process exited
OPTIONS
--strict-match
Print only entries that match *all* of the arguments on the command line.
--user name
List records for user with name. This is useful if you're trying to match a username that happens to be the same as a command
(e.g., ed ).
--command name
List records for command name.
--tty name
List records for tty name.
-f filename, --file filename
Read from the file filename instead of acct
--debug
Print verbose internal information.
-V, --version
Print the version number of lastcomm.
-h, --help
Prints the usage string and default locations of system files to standard output and exits.
FILES
acct
The system wide process accounting file. See acct(5) (or pacct(5)) for further details.
AUTHOR
The GNU accounting utilities were written by Noel Cragg <noel@gnu.ai.mit.edu>. The man page was adapted from the accounting texinfo page by
Susan Kleinmann <sgk@sgk.tiac.net>.
SEE ALSO
last(1), acct(5)
1995 October 31 LASTCOMM(1)