-
Newbie ? : Sed vs Awk: Best Way To Filter a Pattern Match From String?
I'm new to bash, and still uncertain when/how to use sed vs awk.
I'm trying to assign all pattern matches in a string to a variable, and then filter them from a string.
Here's the pattern:
[space]*[space][space]* # 2 spaces and any character afterward until the next space.
Or if at the start of string:
*[space]
Example:
raw_string='test1 this is test2 string'
I want: test1, test2 assigned to variables. And then filter the string to match, 'this is a string'.
What is the right way to do this in bash?
Thanks
-
Every Linux Geek Needs To Know Sed and Awk. Here's Why...
... Awk, like Sed, is a programming language designed for dealing with large bodies of text. But while Sed is used to process and modify text, Awk is mostly used as a tool for analysis and reporting.
[...continues...]
More here: https://www.google.com/search?q=when...use+sed+vs+awk
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|