LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 537 Comments 0 NullTerminator is offline
Old

QT Notes

Posted 02-19-2013 at 05:31 PM by NullTerminator

Interesting article/sample
http://snipplr.com/view/48394/
LQ Newbie
Posted in Uncategorized
Views 313 Comments 0 NullTerminator is offline
Old

IBM AS400 DB2 SQL Tricks

Posted 02-08-2013 at 10:20 AM by NullTerminator

set schema mySchema

Select x,y,z from w
fetch first 20 rows only

reset an auto counter that got hosed
alter table T alter TheColumn restart with 123

grab the first non null value
select a,b,c, coalesce(z,y,z) as FirstGoodValue from T

Case
select A, case when x < 0 then 'Negative' else 'Positive' end from T

TIMESTAMP format is 'YYYY-MM-DD-hh.mm.ss.uuuuuu'

get month from a date...
LQ Newbie
Posted in Uncategorized
Views 575 Comments 0 NullTerminator is offline
Old

sed awk tr etc

Posted 01-15-2013 at 06:33 AM by NullTerminator
Updated 01-18-2013 at 06:54 AM by NullTerminator (add sed cmd for non prinitng char)

A couple sample to strip unreadable characters from a binary file
Code:
# Translate junk characters into newlines while squeezing
C:\Temp>tr -sc '[\011\012\015\040-\176]' \n < blob_of_data.txt

# Translate and discard single character lines
C:\Temp>tr -sc '[\011\012\015\040-\176]' \n < blob_of_data.txt | awk "length($0) > 1"
# replace a bad character in a file
0xa0 is a 'non breaking space' that appears often when...
LQ Newbie
Posted in Uncategorized
Views 620 Comments 0 NullTerminator is offline
Old

IBM AS400 DB2 Catalog Views

Posted 11-29-2012 at 08:57 AM by NullTerminator

Various objects are available to query the underlying meta data.
select * from qsys2.sysviews where view_owner ='xyz' and TABLE_NAME = 'tab1'
select * from qsys2.systables where table_owner ='xyz' and TABLE_NAME NOT LIKE 'SYS%'

-- Stored Procedures, SIMILAR RESULTS from sysroutines
select * from qsys2.sysprocs where routine_schema ='xyz' and ROUTINE_NAME NOT LIKE 'SYS%'

Other catalog views
SYSINDEXES
SYSKEYS
SYSPROCS
...
LQ Newbie
Posted in Uncategorized
Views 742 Comments 0 NullTerminator is offline

  



All times are GMT -5. The time now is 03:43 AM.

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