KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have a text file with various entries in it. Each entry is ended with line containing all asterisks. I'd like to use shell commands to parse this file and assign each entry to a variable. How can I do this? Here's an example input file: *********** Field1 *********** Lorem ipsum Data to match *********** More data Still more data *********** Here is what my solution looks like so far: #!/bin/bash for error in `python example.py | sed -n '/.*/,/^\**$/p'` do echo -e $error echo -e "\n" done However, this just assigns each word in the matched text to $error, rather than a whole block.
Tags (comma-separated)
Save Edits
Cancel