With awk
:
awk '{for(i=1;i<=NF;i++) if ($i=="--pe_cnt") print $(i+1)}' inputFile
Basically loop over each word of the line. When you find the first you are looking for, grab the next word and print it.
With grep
:
grep -oP "(?<=--pe_cnt )[^ ]+" inputFile
More Related Contents:
- create a file with prefix =file1 followed by the random number
- Why to code a script which will check if some package is installed in linux and if not then install it?
- Read values into a shell variable from a pipe
- Fastest way to find lines of a file from another larger file in Bash
- How to replace spaces in file names using a bash script
- Use sudo with password as parameter [closed]
- Shell script: Run function from script over ssh
- How can I quickly sum all numbers in a file?
- Bash script process substitution Syntax error: “(” unexpected
- What is the difference between using `sh` and `source`?
- Get the Perl rename utility instead of the built-in rename
- Automating telnet session using bash scripts
- Run a shell command when a file is added
- How do I syntax check a Bash script without running it?
- Pass a password to ssh in pure bash
- extracting unique values between 2 sets/files
- Pattern match does not work in bash script
- Unable to export the variable through script file [duplicate]
- CURL to access a page that requires a login from a different page
- How do you normalize a file path in Bash?
- How do I get cURL to not show the progress bar?
- Using `date` command to get previous, current and next month
- Linux: remove file extensions for multiple files
- Joining multiple fields in text files on Unix
- How to automatically add user account AND password with a Bash script?
- Meaning of tilde in Linux bash (not home directory)
- How do I delete all lines in a file starting from after a matching line?
- How to convert hex to ASCII characters in the Linux shell?
- How to check if a program is run in Bash on Ubuntu on Windows and not just plain Ubuntu?
- Bash `wait` command, waiting for more than 1 PID to finish execution