I have one project's .git/config file in which I have following contents:
[user] name = <FullName> email = <EmailID> username = <UserName> [core] editor = nvim whitespace = fix,-indent-with-non-tab,trailing-space,cr-at-eol pager = delta [web] browser = google-chrome .... .... [alias] a = add --all ai = add -i ############# ap = apply as = apply --stat ac = apply --check .... .... [filter "lfs"] clean = git-lfs clean -- %f smudge = git-lfs smudge -- %f process = git-lfs filter-process required = true
Now I want to copy multiple sections and their contents like [alias], [filter "lfs"] etc. but not the [user] and [web] sections from this .gitconfig file to another project's (which is under same parent as this project's directory) .gitconfig file.
Now I know I can loop thro' and print lines of this file, but not idea how to write multiple sections to another file(with less code clutter as possible) such that it doesn't overwrite target file's original contents:
while read line || [ -n "$line" ]; do echo $line; done < $filename;
Help is much appreciated...