Tips tagged sed


-2

Tip #234   unwrapping ldapsearch's ldif output

I'm working on a project to access data from my corporate Active Directory server using ldapsearch. The version of ldapsearch that comes with Red Hat Enterprise Server spews out LDIF in column truncated format. That is to say it inserts a carriage return at column 80 of the output.

This sed goodie unwraps the ldif output.

UNWRAP=' /^ / {; H; d; }; /^ /! {; x; s/\n //; }; ' Read more »

-9

Tip #233   Remove numbers from history

Use the following command to give a history listing without the numbers for easier copy and pasting:

Read more »

10

Tip #210   Calendar with current date

Add the following sed commands to cal to get a calendar with the current date marked:

Read more »

13

Tip #209   Directory Tree

The following alias will print the directory structure from the current directory in tree format.

Read more »

32

Tip #205   Convert permissions to octal

Converts the symbolic permissions to octal (ie: numbers) when using 'ls -l':

Read more »

5

Tip #182   MAC address conversion

Convert mac addresses such as 000000abde00 into 00:00:00:ab:de:00

awk '{for(i=10;i>=2;i-=2)$0=substr($0,1,i)":"substr($0,i+1);print}' macaddress_list
sed 's/\(..\)/\1:/g;s/:$//' macaddress_list

// sil at infiltrated.net
Read more »

19

Tip #177   Copy and paste from the command line

Add the following alias and function to your profile to be able to copy and paste files at the command line:

Read more »

13

Tip #172   Create daily backups

To create a set of backed up files with the current date added at the end of the file name try the following:

Read more »

9

Tip #171   Duplicate directory tree

The following command creates in the /usr/project directory, a copy of the current working directory structure:

Read more »