Help using Base SAS procedures

Unix Command

Accepted Solution Solved
Reply
Regular Contributor
Posts: 168
Accepted Solution

Unix Command


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


Accepted Solutions
Solution
‎11-14-2013 10:24 PM
Respected Advisor
Posts: 3,887

Re: Unix Command

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


All Replies
Super User
Posts: 5,256

Re: Unix Command

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
Super User
Super User
Posts: 6,499

Re: Unix Command

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.

Regular Contributor
Posts: 168

Re: Unix Command


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

Respected Advisor
Posts: 3,887

Re: Unix Command

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.

Regular Contributor
Posts: 168

Re: Unix Command

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

Trusted Advisor
Posts: 1,128

Re: Unix Command

i found this , thought will be useful

Unix/Linux "find" Command Tutorial

Thanks,

Jagadish

Thanks,
Jag
Regular Contributor
Posts: 168

Re: Unix Command

Thanks Jagadish!!!

Solution
‎11-14-2013 10:24 PM
Respected Advisor
Posts: 3,887

Re: Unix Command

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

Trusted Advisor
Posts: 1,300

Re: Unix Command

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...

Regular Contributor
Posts: 168

Re: Unix Command

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

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

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