Search Results

Search: Posts Made By: Glenn Arndt
2,885
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,278
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,278
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...
6,676
Posted By Glenn Arndt
Oops! Thanks for catching that.
Oops! Thanks for catching that.
6,676
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,635
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,635
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...
5,046
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'
5,046
Posted By Glenn Arndt
:mad: Woops, won't work for long lists; disregard.
:mad: Woops, won't work for long lists; disregard.
10,132
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
3,262
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.*"
3,262
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
3,262
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?
3,262
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
11,238
Posted By Glenn Arndt
for myfile in CC*; do # Do stuff here ...
for myfile in CC*; do
# Do stuff here
print $myfile
# etc.
done
28,200
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...
33,658
Posted By Glenn Arndt
cygwin (http://www.cygwin.com) UWIN...
cygwin (http://www.cygwin.com)
UWIN (http://www.research.att.com/sw/tools/uwin/)
10,952
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.
30,966
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,907
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....
9,343
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)}'
50,895
Posted By Glenn Arndt
Try:echo $0
Try:echo $0
30,966
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 ".."....
30,966
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,957
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

 
All times are GMT -4. The time now is 06:08 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy