- or download this
awk -v RS='' -v ORS='\n\n' '/^[^ ].*$/' file.txt | awk -v RS='' 'NR==1
+{print $0}'
- or download this
perl -0pe 's/.*?\n*?([^ \n].*?)\n\n.*/$1/gs' file.txt
- or download this
perl -0pe 's/([^ \n].*?)\n\n.*/$1/gs' file.txt
- or download this
perl -0pe 's/.*?\n([^ \n].*?)\n\n.*/$1/gs' file.txt
- or download this
if ( $. == 1 and /^[^ ].*$/ ) {...}
- or download this
echo '' > tempfile.txt ; cat file.txt >> tempfile.txt ; perl ...
- or download this
if [[ $(egrep -n -m1 -e '^[^ ]' file.txt | sed 's/^\([0-9]\+\):.*/\1/g
+') -eq 1 ]] ; then perl ... ; else perl ... ; fi