From d7514e27c480e27a39971c6a116c0309af06a2e4 Mon Sep 17 00:00:00 2001 From: "Scott C. MacCallum" Date: Sat, 25 Feb 2023 00:41:03 +0000 Subject: [PATCH] Variables now working in Sed --- cluster-web-to-other.sh | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/cluster-web-to-other.sh b/cluster-web-to-other.sh index 3b27403..6f75580 100755 --- a/cluster-web-to-other.sh +++ b/cluster-web-to-other.sh @@ -15,14 +15,13 @@ wget -O /sdf/arpa/ns/s/scm/index.html https://scm.sdf.org wget -O /sdf/arpa/ns/s/scm/$month.html https://scm.sdf.org/posts/$year/$month.html -# Remove the post related lines from the index HTML file +# Remove the posts header line from the index HTML file sed -i 's/

Posts<\/h3>//' /sdf/arpa/ns/s/scm/index.html -# This line works as it is but ideally the year and month would use -# variables. I don't know how to this yet and will move forward. +# Remove the posts lines from the index HTML file -sed -i 's/

2023<\/a><\/h4>//' /sdf/arpa/ns/s/scm/index.html +sed -i "s/

{$year}<\/a><\/h4>//" /sdf/arpa/ns/s/scm/index.html # Convert the index HTML file to an index text file @@ -55,14 +54,10 @@ cat /sdf/arpa/ns/s/scm/footer | col -b -x > /sdf/arpa/ns/s/scm/footer.sdf # Write the posts text file to the .plan cluster text file # Change the head number as needed when the index.html file is changed -head -n 10 index.sdf > /sdf/arpa/ns/s/scm/header - +head -n 5 index.sdf > /sdf/arpa/ns/s/scm/header cat /sdf/arpa/ns/s/scm/$month.sdf > body - cat /sdf/arpa/ns/s/scm/header > /sdf/arpa/ns/s/scm/.plan - cat /sdf/arpa/ns/s/scm/body >> /sdf/arpa/ns/s/scm/.plan - cat /sdf/arpa/ns/s/scm/footer.sdf >> /sdf/arpa/ns/s/scm/.plan # Write the index text file to the root directory of Gopher @@ -83,7 +78,9 @@ chmod -R 754 /ftp/pub/users/scm scp /sdf/arpa/ns/s/scm/.plan scm@ma.sdf.org:/meta/s/scm -scp /sdf/arpa/ns/s/scm/index.sdf scm@ma.sdf.org:/meta/gemini/scm/index.gmi +scp /sdf/arpa/ns/s/scm/header scm@ma.sdf.org:/meta/gemini/scm/index.gmi + +cat /sdf/arpa/ns/s/scm/body | ssh scm@ma.sdf.org "cat >> /meta/gemini/scm/index.gmi" scp /sdf/arpa/ns/s/scm/$month.sdf scm@ma.sdf.org:/meta/gemini/scm/posts/$year/$month.gmi