-
Notifications
You must be signed in to change notification settings - Fork 0
/
filtered.sh
36 lines (28 loc) · 925 Bytes
/
filtered.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#! /bin/bash
# Basic script that pulls the page source from sites based on user input
# Stores the file in TXT format
# Be sure file is executable -- ex: chmod +x filename.sh
# This is a WIP, I plan to add parameters
# Ask for input
echo "What webpage would you like to view the source on? "
# Read Input
read page
# Prompt for File Name
echo "What would you like to name your source file? "
# Read the response
read name
# Run Command to pull source
if [[ "$page -eq $page" ]]
then
curl $page > $name.txt
# Prompt for text search
echo "What contents would you like to search? "
read filter
# Prompt for filename
echo "What do you want to name your filtered file? "
read file
# Filter text based on user params
grep $filter $name.txt > $file.txt
echo "File has been filtered! You can find $file.txt in your Current Directory!"
echo "Thank you! "
fi