dirpath script using sed


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting dirpath script using sed
# 1  
Old 11-24-2010
dirpath script using sed

Hey guys,

I have to make a script that will show a formatted listing of permissions of a directory, and of all the directories in its path, starting from the root directory. It should work if the directory is specified using absolute or relative path. If not listed like that it will just execute for the current working directory. The script also highlights the directory which don't have execute permissions for other users.
Code:
ex:
dirpath dir1

  Owner   Group   Other   Filename
  -----   -----   -----   --------
d r w x   r - x   r - x   /
d r - x   r - x   r - x   home
d r w x   - - x   - - t   user
d r w x   - - x   - - x   public
d r w x   - - x   - - -   files(this would be highlighted in black)
d r w x   - - x   - - x   assigment

If anyone could help me this I would really apprecaite it. I am just
not sure to begin and I have no clue how I would go about highlighting.
The only thing I am sure about is that I think have to use sed for the final output just by the looks of it.

Last edited by Joey12; 11-24-2010 at 01:52 PM..
# 2  
Old 11-24-2010
Why does it have to be 'sed'?
This sounds like a homework assignment.

Do not post classroom or homework problems in the main forums. Homework and coursework questions can only be posted in this forum under special homework rules.

Please review the rules, which you agreed to when you registered, if you have not already done so.

More-than-likely, posting homework in the main forums has resulting in a forum infraction. If you did not post homework, please explain the company you work for and the nature of the problem you are working on.

If you did post homework in the main forums, please review the guidelines for posting homework and repost.

Thank You.

The UNIX and Linux Forums.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

sed script help

I am having a file as stated below : File 1: ########################## idnd a integer 2; list 1 ; list2 ; chip top alist( .a(1) , .b(2) , .c(3) , .d(1) , .e(7) , .n(80), .d(1) , .g(7) , .n(80), .f(1) , .e(7) , .m(80)); lis 7 nfj ; jdjd kn; jsjd l ; (4 Replies)
Discussion started by: kshitij
4 Replies

2. UNIX for Dummies Questions & Answers

Need help with a sed script

Hello, I'm trying to write a sed script for this. I have to delete the '\i' and '\b', except when it is between \* \* Here is an example: Before sed script: I \* hope \bthat \b I \* \iwill \i find \*\bthe \b answer.\* After sed script: I hope \bthat \b I will find \bthe \b answer. ... (4 Replies)
Discussion started by: ikke008
4 Replies

3. Shell Programming and Scripting

Need help with sed script

I wanted to create a script for batch file renaming if I run the following from the command line for i in *.docx; do mv "$i" "`echo $i | sed "s/%/_/g"`"; doneit works....but when I create a script file name rename.bash with the following code: #!/bin/bash for i in *.docx do mv... (2 Replies)
Discussion started by: kyros
2 Replies

4. Shell Programming and Scripting

SED script

Hi , i am stuck in this simple script. #!/bin/ksh echo "enter the file name" read flname echo "enter version" read ver grep $flname /home/con/snsc/perl/map > flplist dirname `cat flplist` | sed 's/\/so${vers}\//\/so${vers}_xyz\//' > dirlist the map file is basically a list of file... (3 Replies)
Discussion started by: debu182
3 Replies

5. Shell Programming and Scripting

Sed script help

Hi All, I have a requirement where i have a test file which has a list of filenames, i have to read through the text file, and replace the filename with path and filename Here is my code im using... for line in `cat ~/manipulate.txt` do `sed 's/$line/cksum $line... (6 Replies)
Discussion started by: raghu_shekar
6 Replies

6. Linux

How to create file on Linux using environment variable in the dirpath

Hi all, I am running a Java program on a Linux server in which I read in a base directory path from the *.properties file. During processing, I build a unique file name and create a file to save data, concatenating the directory path and the file name. Works fine, except that I now need to... (2 Replies)
Discussion started by: patricia1of5
2 Replies

7. UNIX for Dummies Questions & Answers

sed script

:rolleyes: I have a series of folders /temp/a /temp/b /temp/c In folders a, b, and c, I have files a1.txt..........a20.txt b1.txt..........b40.txt & c1.txt..........c60.txt Each file has the same data format :- Line... (2 Replies)
Discussion started by: grinder182533
2 Replies

8. Shell Programming and Scripting

sed in a script

I am trying to run a sed command within a script to edit a file. I am trying to put the value of MYUSER into the sshd_config file. Instead of putting the value of the variable, MYUSER, it puts in the string ${MYUSER}. Anyone know a good solution to this? cat ${SSHD_CONFIG} | sed... (1 Reply)
Discussion started by: Mike_the_Man
1 Replies

9. Shell Programming and Scripting

Help with Script may be using SED

Hello Everybody, I have a directory in Unix(AIX) called DATA where every month I get some data copied like the following:i.e in /DATA i have the following ENCTR01.TXT DISCH01.TXT DIAG01.TXT and many more rows like this..... I want to remove the '01' from these lines and make them... (4 Replies)
Discussion started by: thumsup9
4 Replies

10. Shell Programming and Scripting

Sed script maybe?

I have a lot of script files that were created by Extract in a dir that no longer exists. Now that I have to run these scripts they 'all' have to be changed. I'm looking for a way to do a 'mass' change if possible. So far, I've dumped all of the script file names to a file and sorted them to... (5 Replies)
Discussion started by: HOlli
5 Replies
Login or Register to Ask a Question