27 lines
703 B
YAML
27 lines
703 B
YAML
name: Filter text using shell and grep
|
|
inputs:
|
|
- {name: Text}
|
|
- {name: Pattern, default: '.*'}
|
|
outputs:
|
|
- {name: Filtered text}
|
|
metadata:
|
|
annotations:
|
|
author: Alexey Volkov <alexey.volkov@ark-kun.com>
|
|
canonical_location: 'https://raw.githubusercontent.com/Ark-kun/pipeline_components/master/components/sample/Shell_script/component.yaml'
|
|
implementation:
|
|
container:
|
|
image: alpine
|
|
command:
|
|
- sh
|
|
- -ec
|
|
- |
|
|
text_path=$0
|
|
pattern=$1
|
|
filtered_text_path=$2
|
|
mkdir -p "$(dirname "$filtered_text_path")"
|
|
|
|
grep "$pattern" < "$text_path" > "$filtered_text_path"
|
|
- {inputPath: Text}
|
|
- {inputValue: Pattern}
|
|
- {outputPath: Filtered text}
|