Left outer join on two files in unix

It’s join -t ‘|’ file1 file2 -a1 Options used: t: Delimiter. a: Decides the file number from which the unpaired lines have to be printed. join -t ‘|’ file1 file2 -a2 would do a right outer join. Sample Run [aman@aman test]$ cat f1 01|a|jack|d 02|b|ron|c 03|d|tom|e [aman@aman test]$ cat f2 01|a|nemesis|f 02|b|brave|d 04|d|gorr|h [aman@aman test]$ … Read more

How to get a decimal number when dividing in bc?

scale = 20 It sets the number of decimal places. $ bc bc 1.06 Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc. This is free software with ABSOLUTELY NO WARRANTY. For details type `warranty’. 355/113 3 scale=20 355/113 3.14159292035398230088 quit $

Extract column using grep

You need to use awk: awk ‘{print $1,$3}’ <namefile> This simple command allows printing the first ($1) and third ($3) column of the file. The software awk is actually much more powerful. I think you should have a look at the man page of awk. A nice combo is using grep and awk with a … Read more

Differences between System V and Posix semaphores

From O’Reilly: One marked difference between the System V and POSIX semaphore implementations is that in System V you can control how much the semaphore count can be increased or decreased; whereas in POSIX, the semaphore count is increased and decreased by 1. POSIX semaphores do not allow manipulation of semaphore permissions, whereas System V … Read more

Where does ‘.’ and ‘..’ come from?

Excerpt from an interview with Ken Thompson (9-6-89): Every time we made a directory, by convention we put it in another directory called directory – directory, which was dd. Its name was dd and that all the users directories and in fact most other directories, users maintain their own directory systems, had pointers back to … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)