09-26-2008
Thanks a lot for your reply... :-)
I am looking into find command and see if i can get out of it some useful stuff...
My motive is to
1. search a patter in all the files in directory and sub-directories
2. List all the files which cantains this pattern
3. see the permission of these files...
I am working on to find the solution, if you can also give some solution with an example, that would be very helpful...
Thanks again!
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Please help. Here is my problem. I have 9000 lines in file a and 500,000 lines in file b. For each line in file a I need to search file b and remove that line. I am currently using the grep -v command and loading the output into a new file. However, because of the size of file b this takes an... (4 Replies)
Discussion started by: mjs3221
4 Replies
2. Shell Programming and Scripting
Hi,
I have a file which computes fields number and some column produced "nan"
I would like to convert the "nan" value to 0 basically.
q=`echo $i $j |awk '{printf("%f",($2/($1+$2)))}'
The above is the command which I use for computation. However, I would
like to check if $1 and $2 is 0, it... (1 Reply)
Discussion started by: ahjiefreak
1 Replies
3. UNIX for Dummies Questions & Answers
Hi all,
Would like to know how I could search for a string 'xyz' but have the output show the line plus the line above and/or below all lines found.
eg. search for xyz from file containing:
abc
12345
asdf xyz asdfds
wwwww
kjkjkj
ppppp
kkkxyz
eeee
zzzzz
and the output to... (2 Replies)
Discussion started by: sammac
2 Replies
4. Shell Programming and Scripting
hello,
I have to write a script to run the other script inside it.So iam planning to write like this?
first check the perimissions of the file.
Alogorthim
----------
if(!filepermissions == execute)
then
echo" Permissions denined"
else
execute the script.
file name is : load_mf.sh... (1 Reply)
Discussion started by: rajkumar_g
1 Replies
5. Shell Programming and Scripting
Hi,
i have to insert the content of source.txt into the searched pattern of the file second.txt.
$cat source.txt
One
Two
Three
.
.
$cat second.txt
This is second file
pattern match start here
pattern match end here
end of the file
so the result will be like this (4 Replies)
Discussion started by: posix
4 Replies
6. Programming
Hi,
For a particular set of files, am trying to check if they are writable. i.e., checking whether they are having permissions greater than 755.
Am able to check this using the statement:
"if (os.path.isfile(FILE_PATH) and (os.stat(FILE_PATH).st_mode & 0777) == 0777):"
But the problem here... (0 Replies)
Discussion started by: arjun_arippa
0 Replies
7. Shell Programming and Scripting
Hi,
For a particular set of files, am trying to check if they are writable. i.e., checking whether they are having permissions greater than 755.
Am able to check this using the statement:
"if (os.path.isfile(FILE_PATH) and (os.stat(FILE_PATH).st_mode & 0777) == 0777):"
But the problem... (1 Reply)
Discussion started by: arjun_arippa
1 Replies
8. UNIX for Dummies Questions & Answers
Is there a way to check when the permissions for the file got changed in AIX
IS there some file which logs all these details?
Best regards,
Vishal (4 Replies)
Discussion started by: Vishal_dba
4 Replies
9. Shell Programming and Scripting
Hello All,
While searching for the question, I found some answers but my implementation is not giving expected output.
I have two files; one is sourcefile, other is named template.
What I want to do is to search each line in template, when found all columns, cut the matching line from source... (4 Replies)
Discussion started by: baris35
4 Replies
10. Shell Programming and Scripting
Hello,
I would like to know if it's a good practice to check the file permissions of the contents of a directory before moving them. For example:
mv -- "$directory"/* "$directory"/.* "$directory"/..?* "$destination"The variables $directory and $destination contain the path to an existing... (6 Replies)
Discussion started by: Cacializ
6 Replies
TREE(1) General Commands Manual TREE(1)
NAME
tree - list contents of directories in a tree-like format.
SYNOPSIS
tree [ -adfgilnpqstuxACDFN ] [ -P pattern ] [ -I pattern ] [ directory ... ]
DESCRIPTION
Tree is a recursive directory listing program that produces a depth indented listing of files. Color is supported ala dircolors if the
LS_COLORS environment variable is set, output is to a tty, and the -C flag is used. With no arguments, tree lists the files in the current
directory. When directory arguments are given, tree lists all the files and/or directories found in the given directories each in turn.
Upon completion of listing all files/directories found, tree returns the total number of files and/or directories listed.
By default, when a symbolic link is encountered, the path that the symbolic link refers to is printed after the name of the link in the
format:
name -> real-path
If the `-l' option is given and the symbolic link refers to an actual directory, then tree will follow the path of the symbolic link as if
it were a real directory.
OPTIONS
Tree understands the following command line switches:
-a All files are printed. By default tree does not print hidden files (those beginning with a dot `.'). In no event does tree print
the file system constructs `.' (current directory) and `..' (previous directory).
-d List directories only.
-f Prints the full path prefix for each file.
-i Makes tree not print the indentation lines, useful when used in conjunction with the -f option.
-l Follows symbolic links if they point to directories, as if they were directories.
-x Stay on the current file-system only. Ala find -xdev.
-P pattern
List only those files that match the wild-card pattern. Note: you must use the -a option to also consider those files beginning
with a dot `.' for matching. Valid wildcard operators are `*' (any zero or more characters), `?' (any single character), `[...]'
(any single character listed between brackets (optional - (dash) for character range may be used: ex: [A-Z]), and `[^...]' (any sin-
gle character not listed in brackets).
-I pattern
Do not list those files that match the wild-card pattern.
-p Print the protections for each file (as per ls -l).
-s Print the size of each file along with the name.
-u Print the username, or UID # if no username is available, of the file.
-g Print the group name, or GID # if no group name is available, of the file.
-D Print the date of the last modification time for the file listed.
-F Append a `/' for directories, a `=' for socket files, a `*' for executable files and a `|' for FIFO's, as per ls -F
-q Print non-printable characters in filenames as question marks instead of the default caret notation.
-N Print non-printable characters as is instead of the default caret notation.
-t Sort the output by last modification time instead of alphabetically.
-n Turn colorization off always, over-ridden by the -C option.
-C Turn colorization on always, unless the LS_COLORS environment variable is not set. Useful to colorize output to a pipe.
-A Turn on ANSI line graphics hack when printing the indentation lines.
FILES
/etc/DIR_COLORS System color database.
~/.dircolors Users color database.
ENVIRONMENT
LS_COLORS Color information created by dircolors
AUTHOR
Steve Baker (ice@mama.indstate.edu)
BUGS
None known. Not heavily tested. Needs a few more options, ala ls.
SEE ALSO
dircolors(1L), ls(1L)
UNIX Programmer's Manual TREE(1)