Unix / Linux Shell: Parse Text CVS File Separator By Field

Posted on in Categories , , last updated March 4, 2014

I work for a small ISP (Internet Service Provider) and we are using Linux and Unix-like operating system with bash shell. I want to write a shell script to parse the csv file line by line. Then line must be parse again field by field. The sample input file is as follows:

example.com,username,groupname,homedir,md5password,permission,secondarygroup

I need to extract each of these example.com,username,groupname,homedir,md5password,permission,secondarygroup fields and passed to the different system utilities. How do I write a shell script to automate this task and use the bash shell to parse a text file?

awk / cut: Skip First Two Fields and Print the Rest of Line

Posted on in Categories , , , , last updated December 21, 2016

I would like to skip first two or three fields at the the beginning of a line and print the rest of line. Consider the following input
    This is a test
    Giving back more than we take

I want my input file with the following output:
    a test
    more than we take

How do I printing lines from the nth field using awk under UNIX or Linux operating systems?

Linux / UNIX: mplayer Play mp3s From a Playlist File

Posted on in Categories , last updated December 19, 2010

I‘m an extreme newbie to the Linux world, but any time I try to get play files according to a playlist file using mplayer command line it turns up this error:

$ mplayer playlist.m3u
MPlayer SVN-r1.0~rc3+svn20090426-4.4.3 (C) 2000-2009 MPlayer Team
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.

Playing playlist.m3u.
Cache fill: 0.00% (44 bytes)

Exiting… (End of file)

How do I fix this and play music without using GUI tools?