I have a variable that stores the output of a file. Within that output, I would like to print the first word after Database:
. I'm fairly new to regex, but this is what I've tried so far:
sed -n -e 's/^.*Database: //p' "$output"
When I try this, I am getting a sed: can't read prints_output: File name too long
error.
Does sed
only take in a filename? I am running a hive query to desc formatted table
and storing the results in output
like so:
output=`hive -S -e "desc formatted table"`
output
is then set to the result of that:
...
# Detailed Table Information
Database: sample_db
Owner: sample_owner
CreateTime: Thu Feb 26 23:36:43 PDT 2015
LastAccessTime: UNKNOWN
Protect Mode: None
Retention: 0
Location: maprfs:/some/location
Table Type: EXTERNAL_TABLE
Table Parameters:
...