提取值并读取为变量 [英] extract value and read as variable

查看:64
本文介绍了提取值并读取为变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Thu Feb 19 10:42:50: Submitted from host <iitmlogin5-ib0>, CWD <$HOME/Bipin/JAS_Data/Big_Domain/128np_IC/Normal_queue>, Output File <file.stdout.159375>, Error File <file.stderr.159375>, Exclusive Execution, 128 Task(s), Requested Resources <span[ptile=16]>; RUNLIMIT

从上面的给定行中,我想提取任务No的值,即'128'和'16'ptile.想在变量中读取此值

from the above given line, I want to extract the values No of tasks i.e '128' and '16' ptile. want to read this values in variable

任务= 128ptile = 16

Task = 128 ptile = 16

推荐答案

您可以将 grep -P read 一起使用:

read task ptile < <(grep -oP '.*\K\b\d+(?= Task)|.*ptile=\K\d+' file | tr '\n' ' ')

echo "[$task] - [$ptile]"
[128] - [16]

这篇关于提取值并读取为变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆