Tiny Core Base > Raspberry Pi
split a string
bmarkus:
--- Quote from: jnovacek on May 20, 2016, 05:25:13 PM ---in other distributions it works, it does not work on Raspberry PI (Tiny Core Linux 7.0),
I get the message "syntax error: unexpected redirection"
--- End quote ---
Your original question was different. Ask what you really want to know :(
bmarkus:
--- Quote from: gavinmc42 on May 21, 2016, 12:43:52 AM ---
One line of shell script with these in it can do the same as 100s of lines of python.
--- End quote ---
Only if you can't use Python. Back to the split, in Python it just a simple string method
--- Code: ---split(';')
--- End code ---
bmarkus:
--- Quote from: Greg Erskine on May 20, 2016, 07:50:10 PM ---Are you using bash?
--- End quote ---
Good question. TC (piCore) is using BusyBox shell ash. If you want to work with Bash, install bash.tcz from repo and explicitely start it.
jnovacek:
I used the "awk"
for my case it's ideal
val1=$(echo "$NAME" | awk -F':' '{print $1}')
val2=$(echo "$NAME" | awk -F':' '{print $2}')
thank you all
Navigation
[0] Message Index
[*] Previous page
Go to full version