07-16-2012
FIND w/ multiple expressions
For reference i am still a newb at scripting, but i have what i think is a complex issue.
I need to run a FIND on / to identify all files and print them to >> $TEMPFILE
I need to avoid MVFS
I need to avoid /var/tmp/nastmp/
I was trying find / \( -type d -name nastmp -prune \) -a \( -fstype mvfs \) -print
But this is not working at all. I can get them to work separately but i need both conditions to be met.
Can someone point me in the right direction?
Last edited by nitrobass24; 07-16-2012 at 07:45 PM..
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I am using a DEC ALPHA running Digital UNIX (formly DEC OSF/1) and ksh. I have a directory with hundreds of files that only share the extension .rpt. I would like to search that directory based on serial number and operation number and only files that meet both requirements to be printed out. I... (6 Replies)
Discussion started by: Anahka
6 Replies
2. Shell Programming and Scripting
Attached is the exact ouput of a vmware VDR log file I am working with but what I am trying to achieve is as follows:
I need to output sections of the file using the string "Normal backup" as the start and "Duration" as the end to seperate files so I can then manipulate them further to create... (2 Replies)
Discussion started by: jelloir
2 Replies
3. UNIX for Dummies Questions & Answers
Hello,
I need help with using grep and regular expressions....
I have a long list of about 1000 lines of Chinese flashcards. Here's a small excerpt:
意文 yìwén (given name)
貴姓 guìxìng (honorable surname)
貴 guì (honorable)
姓 xìng (one's surname is; to be surnamed; surname)
呢 ne (interrogative... (2 Replies)
Discussion started by: arduino411
2 Replies
4. UNIX for Dummies Questions & Answers
I want to search files (basically .cc files) in /xx folder and subfolders.
Those files (*.cc files) must contain #include "header.h" AND x() function.
I am writing it another way to make it clear,
I wanna list of *.cc files that have 'header.h' & 'x()'. They must have two strings, header.h... (2 Replies)
Discussion started by: ritikaSharma
2 Replies
5. Shell Programming and Scripting
Hey guys. I know pratically 0 about Linux, so could anyone please give me instructions on how to accomplish this ?
The distro is RedHat 4.1.2 and i need to find and replace a multiple lines string in several php files across subdirectories.
So lets say im at root/dir1/dir2/ , when i execute... (12 Replies)
Discussion started by: spfc_dmt
12 Replies
6. Shell Programming and Scripting
Guys, need help.
I have a file that contains something like this:
abc
def
ghi
jkl
I want to print the first and last line of the file and the output should be in a single line.
so, output should be like this:
abc jkl (3 Replies)
Discussion started by: solidhelix08
3 Replies
7. UNIX for Advanced & Expert Users
Hi
Could you please advise how can one extract from the output of
find . -name "*.c" -print
only filenames in the current direcotry and not in its subdirectories?
I tried using (on Linux x86_64)
find . -name "*.c" -prune
but it is not giving correct output.
Whereas I am getting... (9 Replies)
Discussion started by: tinku981
9 Replies
8. Shell Programming and Scripting
Hi All.
Attached are two files.
I ran a query and have the output as in the file with name "FILEWITHFOURRECORDS.txt "
I didn't want all the spaces between the columns so I squeezed the spaces with the "tr" command and also added a carriage return at the end of every line.
But in two... (3 Replies)
Discussion started by: sparks
3 Replies
9. Shell Programming and Scripting
Im looking for a bash solution that will use Regular Expressions (not perl, sed or awk) to check the example data below and then give me a status.
which would be just simply Match or Mismatch.
SYS PS1 is present.
Fan status: Normal
Input Voltage status: Normal
... (5 Replies)
Discussion started by: popeye
5 Replies
10. Shell Programming and Scripting
Hello
I am trying to write sed code where it will look through the text for lines with specific expression "Started by user" and when found, will also add the following line, and also lines with another expression "Finished:"
sed -n '/Started by user/, +1p, /Finished:/'... (4 Replies)
Discussion started by: dlesny
4 Replies
LEARN ABOUT LINUX
tempfile
TEMPFILE(1) General Commands Manual TEMPFILE(1)
NAME
tempfile - create a temporary file in a safe manner
SYNOPSIS
tempfile [-d DIR] [-p STRING] [-s STRING] [-m MODE] [-n FILE] [--directory=DIR] [--prefix=STRING] [--suffix=STRING] [--mode=MODE]
[--name=FILE] [--help] [--version]
DESCRIPTION
tempfile creates a temporary file in a safe manner. It uses tempnam(3) to choose the name and opens it with O_RDWR | O_CREAT | O_EXCL.
The filename is printed on standard output. See tempnam(3) for the actual steps involved in directory selection.
The directory in which to create the file might be searched for in this order (but refer to tempnam(3) for authoritative answers):
a) In case the environment variable TMPDIR exists and contains the name of an appropriate directory, that is used.
b) Otherwise, if the --directory argument is specified and appropriate, it is used.
c) Otherwise, P_tmpdir (as defined in <stdio.h>) is used when appropriate.
d) Finally an implementation-defined directory (/tmp) may be used.
OPTIONS
-d, --directory DIR
Place the file in DIR.
-m, --mode MODE
Open the file with MODE instead of 0600.
-n, --name FILE
Use FILE for the name instead of tempnam(3). The options -d, -p, and -s are ignored if this option is given.
-p, --prefix STRING
Use up to five letters of STRING to generate the name.
-s, --suffix STRING
Generate the file with STRING as the suffix.
--help Print a usage message on standard output and exit successfully.
--version
Print version information on standard output and exit successfully.
RETURN VALUES
An exit status of 0 means the temporary file was created successfully. Any other exit status indicates an error.
BUGS
Exclusive creation is not guaranteed when creating files on NFS partitions. tempfile is deprecated; you should use mktemp(1) instead.
EXAMPLE
#!/bin/sh
#[...]
t=$(tempfile) || exit
trap "rm -f -- '$t'" EXIT
#[...]
rm -f -- "$t"
trap - EXIT
exit
SEE ALSO
tempnam(3), mktemp(1)
Debian 30 May 2011 TEMPFILE(1)