≡ Menu

input data

Bash Shell Read a Line Field By Field

How do I read a file field-by-field under UNIX / Linux / BSD Bash shell? My sample input data file is as follows:

device1,deviceType,major,minor,permissions
device2,deviceType,major,minor,permissions
...
....
.
deviceN,deviceTypeN,major,minor,permissions

For each line I need to construct and execute a shell command as follows:
/path/to/deviceMaker --context=$1 -m $permissions $device2 $deviceType $major $minor
[click to continue…]

tsort: UNIX / Linux Perform Topological Sort

Q. How do I perform topological sort or topological ordering without writing code in C or other programming language? How do I performs a topological sort on the given FILE using a shell script?
[click to continue…]

PHP: Verify And Sanitize Email Address

Q. How do I verify input data such as email address under PHP programming language?
[click to continue…]

Apache Log POST Data To A Log File

Q. How do I log POST data submitted by our user registration form to a log file under Debian Linux Apache 2 Web Server?
[click to continue…]

Sed Delete Last Character

How do I delete a last character from input line under UNIX / Linux using sed tool? My sample scientific input data line is as follows and I'd like to get rid of last + character only:

379100.46+521870.11+363838.75+382869.59+

How do I used sed to delete last + character?
[click to continue…]

Bash Read Comma Separated CVS File

How do I read comma separated CVS file under UNIX / Linux / BSD / Mac OS X bash script? My sample file is as follows:

FirstName LastName,DOB,SSN,Telephone,Status

[click to continue…]