Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

844.Text file parser -- How to extract all commands from operation log file in unix platform?

User: editor -- 2011-08-30          << 843  845 >>
Hits: 185
Type: Text file parser   
Search all Text file parser examples
Description:
How to extract all command line input from operation log file in unix platform?
Input Sample:
$ pwd
/tmp
$ ls
....
....
$ mkdir test
$ cd test
... ...
Output Sample:
pwd
ls
mkdir test
cd test
Answer:
Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps.
Assume all words after "$ " are command line input. The solution is to extract all words that preceded by "$" in each line.
1. ctrl-o open log file
2. ctrl-h open 'replace' dialog
* set 'replace unit' to 'Line'
* set 'search for pattern' to:

* set 'replace with pattern' to:

* uncheck 'print unmatched unit' option to skip lines that without $
3. click 'Replace', done.

Screenshot 1:  Replace_Window


Similar Examples:
How to extract all c++ comments from multiple cpp files? (59%)
How to extract all html address from a text file? (58%)
How to extract email address from one or more Word files immediately? (58%)
How to extract all image links from a html file? (58%)
How to extract and join text from multiple files with user defined format? (57%)
How to extract all image links from multiple html files?  (57%)
How to extract all IP address from a text file? (57%)
How to extract the 7th column from text files with 8 columns? (56%)

Check Demo of Text file parser
Keywords:
unix  commands  skip  command line  extract all words  command  without  after  comma  unmatched  words to replace preceded  after each line  extract each line  extract words  extract lines  replace after  line extract  extract line