I needed to ensure that text read from a file was in Title Case. Solution had to be sed
1. This is what I came up with, then I googled and found much simpler solutions that work.
echo "noRTh weST, 0" |sed 's/^\([A-Za-z]\)\([A-Za-z]\+\)/\U\1\L\2/' North weST, 0
2. A simpler solution
echo "noRTh weST, 0" | sed -e 's/.*/\L&/' -e 's/[a-z]*/\u&/g' North West, 0 sed -e 's/.*/\L&/' - Convert all the characters to lowercase sed -e 's/[a-z]*/\u&/g' - Convert only the first character or each word to uppercase.
\L – Turn the replacement to lowercase until a `\U’ or `\E’ is found,
& – References the whole matched portion of the pattern space.
\u – Turn the next character to uppercase
3. Above solution will fail for the following cases
echo "nor'th we'ST, 0" | sed -e 's/.*/\L&/' -e 's/[a-z]*/\u&/g' Nor'Th We'St, 0 echo "nor'th we'ST, 0" | sed -e 's/.*/\L&/' -e 's/[[:graph:]]*/\u&/g' Nor'th We'st, 0
/[[:graph:]]/ – Non-blank character (excludes spaces, control characters, and similar)
Got the following error when compiling c program.
$gcc mydice.cc -o dice
/tmp/cc4uHuB6.o:(.eh_frame+0×13): undefined reference to `__gxx_personality_v0′
collect2: error: ld returned 1 exit status
My version of gcc
Thread model: posix
gcc version 4.7.2 (Debian 4.7.2-5)
Turns out that I was using the wrong file extension.
Once I changed it to mydice.c my problem was solved.
This page (below) gives a fairly good reason as to why I was getting the error.
Network Manager on debian says “Device not managed”
As root edit /etc/NetworkManager/NetworkManager.conf
managed=false to managed=true
restart network manager
I reinstalled my debian system and was not able to browse although I was able to ping other machines on the network. Turned out that my DNS server was not set. I was putting the setting in the DNS section in the Network Connections GUI but clearly I was still doing something wrong.
This is what I would get trying to ping google.
1. Installed the resolvconf package.
2. As root, added the following two lines into /etc/resolvconf/resolv.conf.d/tail
3. Saved and restarted networking.
That sorted me out.
I needed to change only certain occurances.
Best explained with an example.
To change the first one.
$ echo "little kittens on a little boat" | sed 's/little/big/' big kittens on a little boat
To change the second one only.
$ echo "little kittens on a little boat" | sed 's/little/big/2' little kittens on a big boat
To change all the rest starting from the second one.
$ echo "little kittens on a little boat eating little fish" | sed 's/little/big/2g' little kittens on a big boat eating big fish
I got the following error
W: Duplicate sources.list entry http://ftp.de.debian.org/debian/ wheezy/main i386 Packages (/var/lib/apt/lists/ftp.de.debian.org_debian_dists_wheezy_main_binary-i386_Packages)
My /etc/apt/sources.list looks like this:
# deb cdrom:[Debian GNU/Linux 7.1.0 _Wheezy_ - Official i386 DVD Binary-1 20130615-21:54]/ wheezy contrib main
deb cdrom:[Debian GNU/Linux 7.1.0 _Wheezy_ - Official i386 DVD Binary-1 20130615-21:54]/ wheezy contrib main
# wheezy-updates, previously known as ‘volatile’
# A network mirror was not selected during install. The following entries
# are provided as examples, but you should amend them as appropriate
# for your mirror of choice.
# deb http://ftp.debian.org/debian/ wheezy-updates main contrib
# deb-src http://ftp.debian.org/debian/ wheezy-updates main contrib
First hit on google unviels that the duplicate entry is caused by main being listed twice as seen below
I commented out the first one and the problem was solved.