Bash string explode [duplicate]
问题 This question already has answers here : How do I split a string on a delimiter in Bash? (32 answers) Closed 11 months ago . My file looks like this: record=123 date=2012.01.20 10:22 In the bash file I do cat myfile.ini , and then I need to use something like explode, because I need ONLY to grep the 123 numeric record data, and nothing else. How it can be done in the bash ? 回答1: awk -F'=| ' '/record/ {print $2}' Substitute "date" for "record" in the command above to get the date (the time