Skip to content

Cisco IOS section filter for UNIX/Linux systems using python.

License

Notifications You must be signed in to change notification settings

InfeCtlll3/python-json-section

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

python-json-section

Python-json-section is a script to bring "section" features to the unix shell. Instead of querying using jq or similar tools, this script simulates Ciscos IOS "section" command.

This script only works for JSON at the moment and it brings the JSON section or nest based on its opening and closing brackets.

Installation

Use the package manager pip to install the package:

pip install json-section

or from source:

git clone https://github.com/InfeCtlll3/python-json-section.git
cd python-json-section
pip install -e .

Adding folder to the Path

On linux systems, there is a chance that the directory ~/.local/bin is not included by default in your PATH. This directory is used for pip to create links for scripts and binaries.

In case it is not configured, you should receive the following message upon installing:

The script section is installed in '/home/<user>/.local/bin' which is not on PATH.

That said, in order to invoke the section command from your shell, you will need to add this directory to your PATH.

On zsh:

path+=('/home/$USER/.local/bin')

On bash, please check This Link

Usage

sample.json

{
  "key" : {
    "anotherKey" : {
      "yetanotherKey": "value"
    }
  }
}

command:

cat sample.json | section value

output:

    "anotherKey" : {

      "yetanotherKey": "value"

    }

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Issues

Please open a issue or mail me at [email protected]

Features to come

Support for YAML

License

MIT

About

Cisco IOS section filter for UNIX/Linux systems using python.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages