LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Blogs
User Name
Password

Notices

Old

bash read file

Posted 05-24-2013 at 09:20 AM by NullTerminator
Updated 05-24-2013 at 11:26 AM by NullTerminator

Sample of while loop to process input
Code:
#!/bin/sh
##################################
# Purpose: Cleanup any confirmation reports (*.pdf) older than xx days
# Called By:  batch daily cleanup process,  /Applications/xyz/distributor.sh
# Author: jeb
# Date: 4/20/07
# Comments: The while loop is preferred over the find -exec rm {} syntax because it
#           does not spawn a process for each file to be deleted.
#           The script expects
...
LQ Newbie
Posted in Uncategorized
Views 544 Comments 0 NullTerminator is offline
Old

bash sort using a tab delimiter

Posted 09-07-2012 at 01:49 PM by NullTerminator
Updated 09-07-2012 at 02:49 PM by NullTerminator
Tags bash, sort, tab

There are several ways to sort things when fields are tab separated. The simplest I have found is
Code:
TAB=`echo -e "\t"`
sort -t"$TAB" -k 5,3 scrambledFile.tsv > sorted.tsv
syntax may vary for dos shells, possibly as
Code:
set tab=echo "\t"
sort -t"%tab%" -k5,3 scrambledFile.tsv > sortedFile.tsv
As of this posting, both variations are subject to verification of the syntax.
LQ Newbie
Posted in Uncategorized
Views 468 Comments 0 NullTerminator is offline

  



All times are GMT -5. The time now is 01:44 PM.

Main Menu
Advertisement

My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration