- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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:
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Since these are strictly UNIX shell questions, I suggest that you post them on a UNIX forum instead (for the best response).
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Jagadish!!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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:
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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...
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thank you Fried Egg!!! i am still researching the above FIND,GREP and SED ...