You can use xargs
:
grep 'pattern' input | xargs -I% cp "%" "%.bac"
Related Contents:
- When should I wrap quotes around a shell variable?
- Get exit code of a background process
- Is there a way to change the environment variables of another process in Unix?
- What’s the magic of “-” (a dash) in command-line parameters?
- Environment variable substitution in sed
- What does “&” at the end of a linux command mean?
- Aborting a shell script if any command returns a non-zero value
- What does $@ mean in a shell script?
- Better way to rename files based on multiple patterns
- Forcing bash to expand variables in a string loaded from a file
- Linux: copy and create destination dir if it does not exist
- Setting environment variables in Linux using Bash
- How do I use the lines of a file as arguments of a command?
- What is the difference between using `sh` and `source`?
- How do you normalize a file path in Bash?
- What is the difference between “#!/usr/bin/env bash” and “#!/usr/bin/bash”?
- How to compare two DateTime strings and return difference in hours? (bash shell)
- Given two directory trees, how can I find out which files differ by content? [closed]
- How to sort a file in-place?
- How to run a shell script on a Unix console or Mac terminal?
- How to print third column to last column?
- Linux/Unix command to determine if process is running?
- Is it OK to use the same input file as output of a piped command?
- When to wrap quotes around a shell variable?
- Does “argument list too long” restriction apply to shell builtins?
- Using the passwd command from within a shell script
- GROUP BY/SUM from shell
- Finding contents of one file in another file
- What is the difference between “source script.sh” and “./script.sh”?
- How can I copy the output of a command directly into my clipboard?
- How do you run a script on login in *nix?
- Running shell script in parallel
- Difference between shell and environment variables
- Iterate over a list of files with spaces
- Defining a variable with or without export
- Is there a “goto” statement in bash?
- Sorting multiple keys with Unix sort
- Redirect STDERR / STDOUT of a process AFTER it’s been started, using command line?
- How to instruct cron to execute a job every second week?
- How can I pipe initial input into process which will then be interactive?
- Avoid gnome-terminal close after script execution?
- Shell command to tar directory excluding certain files/folders
- Exit code of variable assignment to command substitution in Bash
- ‘find -exec’ a shell function in Linux
- How can I remove the last character of a file in unix?
- How do I syntax check a Bash script without running it?
- How to get file creation date/time in Bash/Debian?
- Syntax with pound and percent sign after shell parameter name [duplicate]
- List files recursively in Linux CLI with path relative to the current directory
- Linux/Unix ‘man’ page syntax conventions