fabianmoronzirfas
12/15/2015 - 12:24 PM

loop.sh

<!doctype html>

<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

  <title>a title</title>
  <meta name="description" content="something">
  <meta name="author" content="me">

  <link rel="stylesheet" type="text/css" href="assets/css/styles.css">

  <!--[if lt IE 9]>
  <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
  <![endif]-->
</head>
<body>
  <script type="text/javascript" src="assets/js/scripts.js"></script>
</body>
</html>
<!doctype html>

<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

  <title>a title</title>
  <meta name="description" content="something">
  <meta name="author" content="me">

  <link rel="stylesheet" type="text/css" href="assets/css/styles.css">

  <!--[if lt IE 9]>
  <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
  <![endif]-->
</head>
<body>
  <script type="text/javascript" src="assets/js/scripts.js"></script>
</body>
</html>
<!doctype html>

<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

  <title>a title</title>
  <meta name="description" content="something">
  <meta name="author" content="me">

  <link rel="stylesheet" type="text/css" href="assets/css/styles.css">

  <!--[if lt IE 9]>
  <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
  <![endif]-->
</head>
<body>
  <script type="text/javascript" src="assets/js/scripts.js"></script>
</body>
</html>
#!/bin/bash
# the next line appends all results of pup
# to the file export.txt
#
# >> appends
#
for f in *.html ; do cat "$f" | pup 'title' >> export.txt ; done

# if you use the following line it will overwrite the export.txt file
#
# > overwrites
# for f in *.html ; do cat "$f" | pup 'title' > export.txt  ; done

# if you want a output file for each file you read in use the
# following line
# for f in *.html ; do cat "$f" | pup 'title' > "${f}-export.txt"  ; done