Search Results

Search: Posts Made By: Glenn Arndt
2,182
Posted By Glenn Arndt
You can make a quick-and-dirty HTML document...
You can make a quick-and-dirty HTML document containing preformatted text from your text file, e.g.:{
print "<html><head><title>My Title Here<title></head><body><pre>"
cat file.txt
print...
3,002
Posted By Glenn Arndt
You can loop through the array you created with...
You can loop through the array you created with this:for x in ${myarray }; do
print $x
done
3,002
Posted By Glenn Arndt
What is the field delimiter? The following...
What is the field delimiter? The following assumes a comma:integer i=0
awk 'BEGIN {FS=OFS=","} {print $3}' file.txt | while read item; do
myarray[$i]=$item
i=$i+1
doneIf the fields are...
5,934
Posted By Glenn Arndt
Oops! Thanks for catching that.
Oops! Thanks for catching that.
5,934
Posted By Glenn Arndt
awk 'BEGIN { FS="," } $1 ~ /Body_Model/ {...
awk 'BEGIN { FS="," }
$1 ~ /Body_Model/ { mydate=$2; print; next }
{ print $1, mydate, $3 }' file.txt
2,267
Posted By Glenn Arndt
I don't disagree with anything you have said,...
I don't disagree with anything you have said, however...
If you're going to assume that whatever program produces these output files produces them with a valid date in the file name, 1) you've made...
2,267
Posted By Glenn Arndt
That would allow for invalid dates, e.g.,...
That would allow for invalid dates, e.g., filename009900.dat. In ksh, give this a try (slightly tested):filename@(0[1-9]|1[0-2])@(0[1-9]|[12][0-9]|3[0-1])@([0-9][0-9]).datKeep in mind that you still...
4,381
Posted By Glenn Arndt
I'll try to redeem myself with something that...
I'll try to redeem myself with something that might work:var=$(<infile.txt); echo $var | sed 's/ /,/g'This also seems to work:echo $(<infile.txt) | sed 's/ /,/g'
4,381
Posted By Glenn Arndt
:mad: Woops, won't work for long lists; disregard.
:mad: Woops, won't work for long lists; disregard.
7,862
Posted By Glenn Arndt
Try this (carefully, not tested):for file in *;...
Try this (carefully, not tested):for file in *; do
if [[ ! -s $file ]]; then
rm $file
fi
done
2,485
Posted By Glenn Arndt
I edited my previous post to fix the syntax of...
I edited my previous post to fix the syntax of the tr command. Note the use of "< tables.*" rather than just "tables.*"
2,485
Posted By Glenn Arndt
Give this a try:integer i=0 tr '\t' ' ' <...
Give this a try:integer i=0
tr '\t' ' ' < tables.* | cut -d" " -f1 | while read table; do
i=i+1
echo "delete from $table;"
echo ".IF ERRORCODE <> 0 Then .QUIT $i"
done > outfile
2,485
Posted By Glenn Arndt
Is that a space after the first field, or...
Is that a space after the first field, or something else like a tab?
2,485
Posted By Glenn Arndt
Use ksh? Try this:integer i=0 cut -d" " -f1...
Use ksh? Try this:integer i=0
cut -d" " -f1 tables.* | while read table; do
i=i+1
echo "delete from $table;"
echo ".IF ERRORCODE <> 0 Then .QUIT $i"
done > outfile
10,932
Posted By Glenn Arndt
for myfile in CC*; do # Do stuff here ...
for myfile in CC*; do
# Do stuff here
print $myfile
# etc.
done
26,982
Posted By Glenn Arndt
Here's a crude way using awk:awk '{ gsub("^...
Here's a crude way using awk:awk '{ gsub("^ *","",$0); gsub(" *$","",$0); gsub(" *"," ",$0); gsub(" ","\n",$0); print $0 }' $fileRemoves leading and trailing whitespace, replaces multiple...
32,048
Posted By Glenn Arndt
cygwin (http://www.cygwin.com) UWIN...
cygwin (http://www.cygwin.com)
UWIN (http://www.research.att.com/sw/tools/uwin/)
8,707
Posted By Glenn Arndt
The alternative if the file is too big would be...
The alternative if the file is too big would be bdiff. Check the man page for diff under WARNINGS for more info.
26,142
Posted By Glenn Arndt
Yes, which is why my "solution" is flawed. My...
Yes, which is why my "solution" is flawed. My home directory, for example, has an .elm/ directory in it.
3,425
Posted By Glenn Arndt
". script.sh" will execute the script in the...
". script.sh" will execute the script in the current environment, as if you had typed all the commands in script.sh at the command prompt. Therefore, an "exit" in the script will exit your session....
8,707
Posted By Glenn Arndt
Do a 'man awk' and see the printf function:awk...
Do a 'man awk' and see the printf function:awk '{printf("%.2f",123456+1.11)}'
49,872
Posted By Glenn Arndt
Try:echo $0
Try:echo $0
26,142
Posted By Glenn Arndt
Do you want to include hidden directories or no?...
Do you want to include hidden directories or no? You can do:ls -Ad .[!.]*That returns all files in the current directory that begin with ".", but do not begin with ".." or wholly consist of ".."....
26,142
Posted By Glenn Arndt
Don't know if this helps or not, but you can get...
Don't know if this helps or not, but you can get all the files in the current directory beginning with "." using find:find . -type f -name ".?*"
EDIT: Note the bold above; without the -type flag,...
2,300
Posted By Glenn Arndt
For the most part, "which binary" should help....
For the most part, "which binary" should help. This won't catch everything, though. For example, you might (unknowingly) have "f" aliased to "ls -alF". If you name your script "f", the alias "f"...
Showing results 1 to 25 of 244

 

Featured Tech Videos

All times are GMT -4. The time now is 07:14 AM.
Unix & Linux Forums Content Copyright 1993-2019. All Rights Reserved.
Privacy Policy