Frequently Asked Questions, Infrequently Asked Questions, and Advanced Documentation
Is the script required?
What the script does, is take some input that might look like this:
FriendsFriends
Jane
Director of Corporate
1,345 friends
and outputs the plain list:
Jane
Ultimately, you will be comparing the old friend’s list and the new friend’s list with the “diff” command to check differences. “diff old_friends_list new_friends_list”. If you prefer to compose the lists manually, then you don’t need the script. It’s only a helper. But the task of sorting the list alphabetically, tidying it up, removing text, and then having to do this every time, might get laborious. It can be automated.
Where is the script?
See Part 2 blog post.
What is this “diff” command I keep hearing about? When I type “diff” into a DOS prompt, it gives an error.
That’s a Linux/Unix/Mac command. Microsoft Windows users would need to choose Powershell, Cygwin, or Bash for Windows.
The Mac/Linux/Cygwin/Bash version of diff is: “diff old_file new_file”
The Powershell version of diff is: “diff (cat old_file) (cat new_file)”
In both cases, you replace old_file and new_file with the actual names of the files to be compared.
How do I install Cygwin or Bash for Windows?
Cygwin: https://cygwin.com/install.html
then, run it. then,
cd C:\facebook
or
(Not recommended yet, it has bugs. See below.) Linux Bash for Windows: http://www.howtogeek.com/249966/how-to-install-and-use-the-linux-bash-shell-on-windows-10/
then, run it. then,
cd /mnt/c/facebook
How do I install Powershell?
Powershell is already included on recent versions of Microsoft Windows. Type Powershell in the Search Box.
I get an error when first running the Powershell script. “cannot be loaded.” “is not digitally signed.”
Launch Powershell as Administrator. Run these commands:
cd C:\facebook
Set-ExecutionPolicy RemoteSigned
Unblock-File .\processfb.ps1
The directory C:\facebook doesn’t exist.
The first time you will need to create it, for example “mkdir facebook”. Or you may choose any directory to work in.
I can’t Right-click-> Paste into the window.
Turn on Quick-Editing features.
Cygwin: right-click on the top menu, Options->Mouse, “Copy on Select”, “Right-click Paste”
Bash: right-click on the top menu, Properties, select Quick-Edit Mode
Powershell: right-click on the top menu, Properties, select Quick-Edit Mode
Can I edit the removal patterns directly? That is, what ought to be removed from my facebook friend’s list.
Yes,
Linux version: create or open includefb.sh, and edit the two arrays:
1 2 3 4 5 6 7 8 9 10 11 |
personalpatterns=( "This is an example. You can replace the words here." "And so is this. Paste in text you would like to delete from the output." "Each entry should match an entire line of text. no more or less." ) personalregexpatterns=( "AcquaintanceFriends" "[0-9\,]+ mutual friends" "[0-9\,]+ friends" ) |
Powershell version: create or open includefb.ps1, and edit the two arrays:
1 2 3 4 5 6 7 8 9 10 11 |
$personalpatterns=@( "This is an example. You can replace the words here.", "And so is this. Paste in text you would like to delete from the output.", "Each entry should match an entire line of text. no more or less." ) $personalregexpatterns=@( "AcquaintanceFriends", "[0-9\,]+ mutual friends", "[0-9\,]+ friends" ) |
Basic text should go into personalpatterns, and if you understand regex then those go in personalregexpatterns. These arrays will be updated when you run the script, so the list may grow. To remove something from the patterns list, edit includefb.sh directly.
How do I get my facebook friend’s list in the first place?
Log into facebook, go to your own profile, click Friends. Click and drag and select the whole list, pic’s and all. Then right-click->Copy. Then paste those results into a file on your computer, in the /facebook folder, and based on the date, such as C:\facebook\2024-11-15.txt
Can I use File->Save in my browser instead, to save the entire html webpage which has Friends on it?
No, that would result in the entire html being saved, and it’s not what this script is expecting, and paradoxically the html seems to not have the whole list we need. The method required is to Copy and Paste from the visible window, and only the Friends List part, not the whole page.
Can I use Bash on Windows instead of Cygwin?
Short (and perhaps over-simplified) answer: No
Long and complicated answer: Hopefully very soon, however this bug prevents foreign characters from being pasted into the console. If 100% of your friends don’t have foreign letters in their names, then maybe it’s ok. Or… if you understand the script reasonably well, you will eventually understand that most things can be done by editing files directly rather than through the console. Specifically, includefb.sh can be edited using Notepad++. Of course the friend lists such as “friends.2010-03-04.txt” can be edited using Notepad++. Then you don’t have to paste anything into bash, when the script is running.
Eventually they will fix the Bash on Windows bug. In the mean time, if you are a power user who can avoid copy-paste into the bash for windows terminal, then it will actually work. Otherwise, Cygwin is safer.
This is so confusing.
Just run “./processfb.sh” from the command-line (or for powershell “.\processfb.ps1”). It will walk you through the process. Some more advice is you should be observing what files get created in your /facebook directory The “ls” or “dir” commands will show the directory contents. A file with a name like “friends.2010-03-04.sorted.txt” will be created. Notice the part of the name “sorted”. That’s the final output file. Then on another day, you will be creating another such file, but with a different date. Then you use the diff command. That’s the goal, just to get diff to work.
What is the correct way to run the script?
While you can simply run “./processfb.sh” (or for powershell “.\processfb.ps1”) without any arguments, and it will explain things step by step, the really ideal syntax is “./processfb.sh input_file_name” , replacing input_file_name with the your input file that you’ve already created, and which is based on the date, so for example “./processfb.sh friends.2010-03-04.txt”. That will generate a “sorted” output file called friends.2010-03-04.sorted.txt. You can re-run this the same way “./processfb.sh friends.2010-03-04.txt”, and each time add more removal patterns. Hit the up arrow in the bash window, to repeat a command.
Can I contact you for help?
At least to start with, I am very curious to get feedback, please use the Contact Form on the website.