Skip to content

Instantly share code, notes, and snippets.

@dishuostec
Created February 13, 2020 02:20
Show Gist options
  • Save dishuostec/a7da9dfc44c9b5db464213752e5a419a to your computer and use it in GitHub Desktop.
Save dishuostec/a7da9dfc44c9b5db464213752e5a419a to your computer and use it in GitHub Desktop.
split config file
[foo]
foo 1
foo 2
[bar]
bar 1
bar 2
rm \[*\].conf
awk '/^\[(.*)\]$/{x=$0".conf";next}{print > x;}' list.txt
@dishuostec
Copy link
Author

will create

[foo].conf

foo 1
foo 2

[bar].conf

bar 1

bar 2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment