1 개요[ | ]
- YAML 파일 분리
Console
Copy
testuser@localhost:~# cat multi.yaml
---
name: first
metadata: a
---
name: second
metadata: b
---
name: third
metadata: c
Console
Copy
testuser@localhost:~# cat split.sh
#!/bin/bash
rm -rf result
mkdir result
awk '
/name:/{
close(file)
file="result/"$NF".yaml"
}
file!="" && !/^--/{
print > (file)
}
' multi.yaml
Console
Copy
testuser@localhost:~# ./split.sh
testuser@localhost:~# head result/*.yaml
==> result/first.yaml <==
name: first
metadata: a
==> result/second.yaml <==
name: second
metadata: b
==> result/third.yaml <==
name: third
metadata: c
Console
2 참고[ | ]
편집자 Jmnote
로그인하시면 댓글을 쓸 수 있습니다.