Posts

Showing posts with the label if

Auto merge data from multiple sheets in a google spreadsheet

Image
Ok, so I heard that you want to merge multiple sheets (let's say 2) in a google spreadsheet? That's easy (after hours of trying :"D) Assuming you have 2 sheets as following: Sheet1 Sheet2: In the merged list or master list you need these information: First Name, Last Name, Company, Job Title, Email Address 1. First thing you need to do is to find out a field to use as merge key . It's Email Address in this case. You also should be noticed that there should be no duplicate email addresses. So in order to get all the unique email addresses from 2 sheets, you need to use UNIQUE. But UNIQUE will also give you a blank row (ending row), so FILTER will do the job: =FILTER(UNIQUE({Sheet1!H2:H;Sheet2!E2:E}),NOT(ISBLANK(unique({Sheet1!H2:H;Sheet2!E2:E})))) Notes: Look at how I refer to another sheet (Sheet!H2:H...) You only enter the formula in cell E2 of the Master list, all the email addresses will be filled in other rows automatically. 2. Then ...

Get WordPress Multisite blog_id by blog's path using wp-cli

You have a csv file has this format (mycsv.csv): path,some_field somepath,some_value anotherpath,another_value ... and you want to get the blog_ids of those path(s). This following bash shell will help you to get blog_ids by taking advantages of wp-cli, get_blogid_from_url.sh: $ chmod +x get_blogid_from_url.sh $ ./get_blogid_from_url.sh mycsv.csv myblog.com /wordpress/path > result.csv The result will be something like: 546,myblog.com/somepath/ 456,myblog.com/anotherpath/ ...

String operations with wildcard in bash shell

To compare strings with wildcard in bash shell you can do as below (there's different between single and double brackets): if [[ $a == z* ]] ...   # True if $a starts with an "z" (pattern matching). if [[ $a == "z*" ]] ... # True if $a is equal to z* (literal matching). if [ $a == z* ] ...     # File globbing and word splitting take place. if [ "$a" == "z*" ] ... # True if $a is equal to z* (literal matching). Reference:   http://www.tldp.org/LDP/abs/html/comparison-ops.html