BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
sam369
Obsidian | Level 7


Hi ,

I have a question on Unix commands.My O/S is UNIX.we are using Xterm.

I know some basic commands to run my sas programs.

to see latest files i am usin

dir -rlt

now my question is if i want so see specific authour programs like

drwxrwsrwx   7 AuthorName  cpp         4096 Jan 28  2013 directoryname/

drwxrwsrwx   7 AuthorName  cpp         4096 Oct  3  2012  directoryname/

drwxrwsrwx   7 MyName  cpp         4096 Jan 28  2013 directoryname/       /*I created these directories or files*/

drwxrwsrwx   7 Myname cpp         4096 Oct  3  2012  directoryname/         /*I created these directories or files*/

i want to see only Authorname created directories which command i need to use?

2)In program i want to search some specific string , how can i search? (Example in Log: ERROR)

3)Can i replace some specific string with another string like in windows i do CNTR+H then repalce the strings !!, In unix is there any cmd?

can some one guide me the online source with examples for basic + little advance Unix commands

Thanks in Advance

Sam

1 ACCEPTED SOLUTION

Accepted Solutions
Patrick
Opal | Level 21

One of the great things about Unix/Linux is that there are a lot of "geeks" out there and it's not too hard to find answers and code for almost everything you're looking for, eg. for searching a string in a text file: Search for a string in a file on UNIX/AIX | Kaps Blogs

Or for find:

http://unixhelp.ed.ac.uk/CGI/man-cgi?find

Unix/Linux "find" Command Tutorial

View solution in original post

10 REPLIES 10
LinusH
Tourmaline | Level 20

Since these are strictly UNIX shell questions, I suggest that you post them on a UNIX forum instead (for the best response).

Data never sleeps
Tom
Super User Tom
Super User

Depends on the flavor of Unix you are using.

1) Personally to get metadata about files I use a SAS data step to read the output of the ls command into a dataset.

2) and 3) sound like editor questions.  There are hundreds of editors for Unix, including running SAS interactively and using the program editor in the SAS Display Manager.

If you are able to use "dir" instead of "ls" to get a list of files then it looks like someone has already added some customizations to your Unix environment.  I would find out who has done that and ask them about how to use your computer and what tools they suggest you use.

sam369
Obsidian | Level 7


Thanks LinusH and tom.

Tom,

I customized few Unix cmd in alias.

Could you specify "There are hundreds of editors for Unix, including running SAS interactively and using the program editor in the SAS Display Manager"

some examples to know more about these

Thanks

Sam

Patrick
Opal | Level 21

As others said how the actual syntax needs to look like will depend on your UNIX shell. On a general level: You can issue a command which returns a list of files and then pipe this list into a second command doing some more filtering, eg:

ls -la | egrep ....

Below syntax might or might not work for you depending on the Unix you're using.

A very powerful command is "find" which - I believe - is implemented for most Unix flavours.

sam369
Obsidian | Level 7

Thank you Patrick!!!

for first point i used your ls- al | grep  option to get desired list.

could you please give some source for FIND command, if possible

Thanks

Sam

Jagadishkatam
Amethyst | Level 16

i found this , thought will be useful

Unix/Linux "find" Command Tutorial

Thanks,

Jagadish

Thanks,
Jag
sam369
Obsidian | Level 7

Thanks Jagadish!!!

Patrick
Opal | Level 21

One of the great things about Unix/Linux is that there are a lot of "geeks" out there and it's not too hard to find answers and code for almost everything you're looking for, eg. for searching a string in a text file: Search for a string in a file on UNIX/AIX | Kaps Blogs

Or for find:

http://unixhelp.ed.ac.uk/CGI/man-cgi?find

Unix/Linux "find" Command Tutorial

FriedEgg
SAS Employee

1. The command FIND is useful for finding files or directories, etc. in the filesystem

find /path/to/directories -user friedegg -type d

2. The command GREP is useful for searching the contents of textual files

grep ERROR /path/to/foo.log

3. The command SED is usefule for performing regular expression find and replace

sed 's/target/replace/g' /path/to/input.file > /path/to/output.file

There are many more utilities which can also be used for this tasks and these commands also have far more functionality that what is strictly exhibited above...

sam369
Obsidian | Level 7

Thank you Fried Egg!!! i am still researching the above FIND,GREP and SED ...

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 10 replies
  • 2396 views
  • 8 likes
  • 6 in conversation