LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-22-2020, 08:33 AM   #1
BudiKusasi
Member
 
Registered: Apr 2017
Distribution: Artix
Posts: 345

Rep: Reputation: 15
Having Bash to parse multiple space-contained words connected by char \,


How within a string, can we have Bash to parse multiple space-contained words connected by escape char \, by the simplest way (1-2 commands/lines) ?

Code:
s="English phrases must be understood are as\ well, even\ if, as\ such"
How to achieve kind of in few variables (may be enclosed by quote pair instead of double quote):
Code:
a="English"
b="phrases"
c="must"
d="be"
e="understood"
f="are"
g="as well,"
h="even if,"
i="as such"
or as array of s variable itself, etc.
 
Old 11-22-2020, 08:50 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,897

Rep: Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318
one way:
Code:
ar=( $s )
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
'find' space-contained search result is printed with enclosing '' (a quote pair) BudiKusasi Programming 3 10-28-2020 12:33 AM
[SOLVED] Need help to config Apache 2.4 to parse PHP code contained in files with .HTML extension guardian46w Linux - Server 12 03-03-2020 08:22 PM
LXer: Words, Words, Words--Introducing OpenSearchServer LXer Syndicated Linux News 0 08-07-2019 02:13 PM
[SOLVED] Using pure Bash commands, how to parse several strings contained in a string separated by space not space between enclosing pair of quotes BudiKusasi Programming 14 02-08-2019 07:47 PM
Use sed to edit string in multiple files not contained in current directory DylanB Linux - Newbie 1 04-07-2011 02:27 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:51 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration