项目作者: adamb3ll

项目描述 :
Simple tool to search a file for a string, if found, search a second string from that point
高级语言: C++
项目地址: git://github.com/adamb3ll/fileparser.git
创建时间: 2018-02-26T06:23:29Z
项目社区:https://github.com/adamb3ll/fileparser

开源协议:MIT License

下载


fileparser

A simple tool for searching for a string and then searching for a second string after the first one is found.
Written in C++. Python and for people who love large executables, Swift. All versions tested on mac OS High Sierra Only

Swift Version

Python Version

  1. fileparser [optional: -verbose] [inputfile] ["first search string"] ["second search string"]
  2. fileparser [optional: -verbose] [-pipe] ["first search string"] ["second search string"]
  3. sudo fileparser -install

Returns 0 for successfully finding the first and second string.

Example usage:

Check to see if a phone is connected to a computer via Bluetooth:

  1. system_profiler SPBluetoothDataType > btdata.txt
  2. ./fileparser btdata.txt "My iPhone" "Connected: Yes"
  3. if [ $? == 0 ]; then
  4. echo "Connected"
  5. else
  6. echo "Not Connected"
  7. fi

Using pipe rather than intermediary file:

  1. system_profiler SPBluetoothDataType | fileparser -pipe "My iPhone" "Connected: Yes"
  2. if [ $? == 0 ]; then
  3. echo "Connected"
  4. else
  5. echo "Not Connected"
  6. fi