Recipes for the rules defined in your Makefiles require specific indentation. Each line in a recipe (i.e. “tests” below) must start with a tab character.
You can run:
cat -n -E -T Makefile
||Show line numbers
||equivalent to -vE
||equivalent to -vT
||display $ at end of each line
||display TAB characters as ^I
||use ^ and M- notation, except for LFD and TAB
Which produces something like:
headers := time.h sys/time.h sys/timeb.h bits/time.h^I^I^I\$
^I bits/types/clockid_t.h bits/types/clock_t.h^I^I^I\$
^I bits/types/struct_timespec.h bits/types/struct_timeval.h^I\$
^I bits/types/struct_tm.h bits/types/timer_t.h^I^I^I\$
routines := offtime asctime clock ctime ctime_r difftime \$
^I gmtime localtime mktime time^I^I \$
^I gettimeofday settimeofday adjtime tzset^I \$
^I tzfile getitimer setitimer^I^I^I \$
^I stime dysize timegm ftime^I^I^I \$
^I getdate strptime strptime_l^I^I^I \$
^I strftime wcsftime strftime_l wcsftime_l^I \$
aux :=^I era alt_digit lc-time-cleanup$
tests := test_time clocktest tst-posixtz tst-strptime tst_wcsftime \$
^I tst-getdate tst-mktime tst-mktime2 tst-ftime_l tst-strftime \$
^I tst-mktime3 tst-strptime2 bug-asctime bug-asctime_r bug-mktime1 \$
^I tst-strptime3 bug-getdate1 tst-strptime-whitespace tst-ftime \$
^I represents a tab character and
$ represents a newline character. You can use this to check for valid tab and newline indentation in your recipes in case you run into this error:
*** missing separator. Stop.
If you’re using vi, make sure to use
:set noet to disable replacement of tabs with a
tabwidth set number of spaces.
Linux provides a command that converts text file from DOS/MAC to UNIX format.
dos2unix man page
netstat -ano | egrep 'Proto|LISTEN'
- -a Show the state of all sockets, including passive sockets used by server processes
- -n Show network addresses as numbers
- -o Show process Id
netstat -ano | grep 8080
Show which application is using that port:
netstat -anb | grep -A 1 "8080"
- -b Display executable listening on port
- -A option is to display the preceding line after greps returned result
SED is a useful Unix command line tool I use for simple text replacement.
Here’s an example to see the directories included in your Windows PATH environment variable. (I use MinGW for a Unix-like Shell in Windows)
displays all directories on one line separated by semicolons.
sed, we can list each directory on its own line.
echo $PATH | sed 's/:/\n/g'
echo $PATH, then pipe the output to the
sed command to do our string replacement. The
/g modifier will substitute ALL matches, not just the first.
Now each directory is listed on a separate line.
Additionally, if you are looking for a specific directory, for example you want to see which SVN installation is included in your PATH, you can use the
echo $PATH | sed -e 's/:/\n/g' | grep -i 'svn'
Once again we pipe the output from
sed and use
grep to show only directories that include SVN. The
-i option is to ignore case (if your folder name includes the text “Svn”, “SVN”, etc.)
Add all unversioned files from the command line using regular expressions.
svn status | grep '^?' | cut -c9- | sed -rn 's/^(.*)$/\"\1\"/p' | xargs svn add
svn status | grep '^?'
lists only un-versioned files.
grabs only filename and path by cutting up to the 9th column removing the ? symbol and whitespace
sed -rn 's/^(.*)$/\"\1\"/p'
surrounds the filename with “double quotes” in case there are any spaces or your command prompt has an issue with the slashes being used in the path.
xargs svn add
executes svn add for each file.