好好努力,有一个好的将来! 日历:
var diarydays="" ; .calendarBigBorder { font-family: "Arial", "Helvetica", "sans-serif", "宋体"; text-decoration: none; width: 170; background-color: #FFFFFF; font-size: 9pt;border:1px dotted #999; } .calendarTd { font-family: "Arial", "Helvetica", "sans-serif", "宋体"; font-size: 9pt; color: #000000; background-color: #eeeeee; height: 18px; width: 11%; text-align: center;} .calendarMInput { font-family: "Arial", "Helvetica", "sans-serif", "宋体"; font-size: 9pt; text-decoration: none; background-color: #FFFFFF; height: 15px; border: 1px solid #666666; width: 19px; color: #0099FF;} .calendarYInput { font-family: "Arial", "Helvetica", "sans-serif", "宋体"; font-size: 9pt; color: #0099FF; text-decoration: none; background-color: #FFFFFF; height: 15px; width: 34px; border: 1px solid #666666;} .calendarMonthTitle { font-family: "Arial", "Helvetica", "sans-serif", "宋体"; font-size: 9pt; font-weight: normal; height: 24px; text-align: center; color: #333333; text-decoration: none; background-color: #eeeeee; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-bottom-style: none; border-top-color: #999999; border-right-color: #999999; border-bottom-color: #999999; border-left-color: #999999;} .calendarNow { font-family: "Arial", "Helvetica", "sans-serif", "宋体"; font-size: 9pt; font-weight: bold; color: #000000; background-color: #C0C9D3; height: 18px; text-align: center;} .calendarDaySat { font-family: "Arial", "Helvetica", "sans-serif", "宋体"; font-size: 9pt; color: #333333; text-decoration: none; background-color: #eeeeee; text-align: center; height: 18px; width: 12%;} .calendarDaySun { font-family: "Arial", "Helvetica", "sans-serif", "宋体"; font-size: 9pt; color: #333333; text-decoration: none; background-color: #eeeeee; text-align: center; height: 18px; width: 12%;} .calendarLink { font-family: "Arial", "Helvetica", "sans-serif", "宋体"; font-size: 9pt; font-weight: normal; color: #333333; text-decoration: none; background-color: #E7E7F6; text-align: center; height: 18px;} .categoryTxt { font-family: "Arial", "Helvetica", "sans-serif", "宋体"; font-size: 9pt; line-height: 23px; color: #333333; text-decoration: none;} .categoryTable { border-right-width: 1px; border-bottom-width: 1px; border-right-style: solid; border-bottom-style: solid; border-left-style: none; border-right-color: #000000; border-bottom-color: #000000; border-top-width: 1px; border-top-style: solid; border-top-color: #71b99c;} var months = new Array("一", "二", "三","四", "五", "六", "七", "八", "九","十", "十一", "十二"); var daysInMonth = new Array(31, 28, 31, 30, 31, 30, 31, 31,30, 31, 30, 31); var days = new Array("日","一", "二", "三","四", "五", "六"); var classTemp; var calendarHover="calendarHover"; var today=new getToday(); var year=today.year; var month=today.month; var newCal; //得到某月天数 function getDays(month, year) { if (1 == month) return ((0 == year % 4) && (0 != (year % 100))) ||(0 == year % 400) ? 29 : 28; else return daysInMonth[month]; } //得到当天时间信息 function getToday() { this.now = new Date(); this.year = this.now.getFullYear(); this.month = this.now.getMonth(); this.day = this.now.getDate(); } //生成日历 function Calendar() { newCal = new Date(year,month,1); //当前月的第一天 today = new getToday(); var day = -1; //用来判断日历中是否为当天 var startDay = newCal.getDay(); //当月开始时间 var endDay=getDays(newCal.getMonth(), newCal.getFullYear());//当月结束时间 var daily = 0; //用来生成日历中的天数值 if ((today.year == newCal.getFullYear()) &&(today.month == newCal.getMonth())) day = today.day; var caltable = document.all.caltable.tBodies.calendar; //得到日历表格的集合 var intDaysInMonth =getDays(newCal.getMonth(), newCal.getFullYear()); //得到当月天数 //生成日历 for (var intWeek = 0; intWeek 字符串用于判断当天是否有日志 var montemp=(newCal.getMonth()+1)"; //选择样式 if(day==daily) cell.className="calendarNow"; else if(diarydays.indexOf(d)!=-1) cell.className="calendarLink"; else if(intDay==6) cell.className = "calendarDaySat"; else if (intDay==0) cell.className ="calendarDaySun"; else cell.className="calendarTd"; //生成值 if ((daily > 0) && (daily 11) { month=0; year=year+1; } else { month=month+1; } Calendar(); } //得到响应事件 function getDiary() { var mon=(newCal.getMonth()+1)"; if ("TD" == event.srcElement.tagName) if (("" != event.srcElement.innerText)&&(diarydays.indexOf(d) !=-1)) { diary.location="/foxmail/archive/"+newCal.getFullY ear()+"/"+mon+"/"+day+".aspx"; window.location.href = diary.location; } } function setDate() { if (document.all.month.value12) { alert("月的有效范围在1-12之间!"); return; } year=Math.ceil(document.all.year.value); month=Math.ceil(document.all.month.value-1); Calendar(); } 年 月 [下月] [上月] document.write("" + days[0] + ""); for (var intLoop = 1; intLoop " + days[intLoop] + ""); document.write("" + days[intLoop] + ""); for (var intWeeks = 0; intWeeks "); for (var intDays = 0; intDays "); document.write(""); } Calendar();
问题如下:
现在有两个文件如
A文件
2 sdf
30 sf
15 sdf
B文件
0 20 sdfsf
21 56 sdfsadfsf
57 200 sdflj
201 500 sfasfd
A中记录是不连续的,B中记录是连续全面的.现在要把A文件中的第一列放到B文件中与第一第二列对比,看在哪个范围内,符合,则把A中第一列及相应的B文件中第三列打出。
awk的一种做法为:
awk 'NR==FNR{a[$1]=$2} NR>FNR{for(i in a) if($1字符串来处理,比如下面的例子:
awk 'BEGIN{a[2]=1;b[10]=2;for(m in a) for(n in b) if(m>n)print m,n,"Yes"}'
执行结果为:
2 10 Yes
从字符串角度看,"2">"10"。
这样,只需将字符串经过 "加0"转化为数字就OK了。
改为:
awk 'NR==FNR{a[$1]=$2} NR>FNR{for(i in a) if($1<=(i+0)&&(i+0)<=$2) print i,$3}' a b
执行结果:
15 sdfsf
2 sdfsf
30 sdfsadfsf
搞定!
发表评论
-
awk用法
2012-07-06 09:46 735awk用法 通用格 ... -
flex中给图片(或任意组件)着色的方法
2012-07-03 13:44 543作者:屈剑峰 2011年4月3日 在fl ... -
PHP作为Flex程序的数据源
2012-07-02 13:27 639Adobe Flash Builder 4 简体中文正式版 ... -
Flex 拖拽范例
2012-07-02 13:26 617Flex由于在其Framwork里加入了DragDrop管 ... -
java与flex通信
2012-07-02 13:26 585一、准备: ... -
Flex中button按钮的例子
2012-07-02 13:26 405本源代码来源于flex完全自学手册 flex/spark ... -
FLEX ComboBox绑定JAVA返回的数据源
2012-07-02 13:26 613万万没有想到会在一个小小的ComboBox上碰这么大钉子, ... -
使用Validator.validateAll对所有验证控件进行验证的例子
2012-07-01 10:54 814调用 validators 数组中的所有验证程序。返回一个 ... -
C#命名规范
2012-07-01 10:53 753本文的结构为:(1)C ... -
Using the Microphone capabilities in Adobe AIR 2
2012-07-01 10:53 661AIR 2 introduces the ability ... -
ActionScript 3.0综合应用案例(图像识别+位图滤镜+Molehill)
2012-07-01 10:53 730本文是对ActionScript 3.0的一个综合应用案例 ... -
Using the Adobe AIR 2 NativeProcess API to create a screen recorder
2012-07-01 10:53 1527With the release of AIR 2, Ad ... -
采用数据库为Flex Tree组件的提供数据-Java与LCDS
2012-06-30 17:15 638采用数据库为Flex Tree组件的提供数据-Java与LCD ... -
Flex air 中调用com组件的方法
2012-06-30 17:15 774Flex air 中调用com组件的方法 2011年03月3 ... -
Flex4 在组件Component中注册事件Event并进行指派dispatch的例子
2012-06-30 17:15 718Flex4 在组件Component中注册事件Event并进行 ... -
flex中给图片(或任意组件)着色的方法
2012-06-30 17:15 547flex中给图片(或任意组件)着色的方法 2011年04月0 ... -
采用数据库为Flex Tree组件的提供数据-FlexTree组件
2012-06-30 17:15 581采用数据库为Flex Tree组件的提供数据-FlexTree ...
相关推荐
主要讲解了关于shell中用awk数组处理文件的用法
自己总结的awk数组相关的思维导图文件,可以下载xmind进行打开,第一次上传文件,多多赐教
用awk进行文本处理,少不了是它的数组处理。那么awk数组有那些特点,一般常见运算又会怎么样呢。我们先看下下面的一些介绍,结合例子我们会讲解下它的... 2:可以用字符串作数组索引(下标) Tarray[“first”]=“ch
主要介绍了Linux中的awk数组的基本使用方法,非常不错,具有一定的参考借鉴价值,需要的朋友可以参考下
若你使用过 Shell 中的 awk 工具,会发现用它来分割字符串是非常方便的。特别是多个连续空格会被当做一个处理。 [root@localhost ~]# cat demo.txt hello world [root@localhost ~]# [root@localhost ~]# awk ...
第二、找出组成字符串的字符个数和字符串的存储结构(比如数组)。 第三、对串的常规操作:求子串、插入字符、删除字符、置换字符、字符串的比较等。 第四、对串的一些比较复杂而有趣的操作,这里将在最后介绍一些...
统计文件中的所有字符串出现的次数,在行尾未完的字符用"-"连接,c语言编写,包括"rdline.c","abc",编译"rdline.c"后直接,运行就行,不要加参数,会自动读取"abc"中的内容。
AWK是一种优良的文本处理工具。它不仅是 Linux 中也是任何环境中现有的功能最强大的数据处理引擎之一
计算字符串长度可用的三种方法: 代码如下: echo “$str”|awk ‘{print length($0)}’ expr length “$str” echo “$str”|wc -c 但是第三种得出的值会多1,可能是把结束符也计算在内了 判断字符串为空的方法...
一、Linux shell 截取字符变量的前8位...二、按指定的字符串截取1、第一种方法:${varible##*string} 从左向右截取最后一个string后的字符串${varible#*string}从左向右截取第一个string后的字符串${varible%%string*}从
算数函数、字符串函数、其它一般函数、时间函数
在做shell批处理程序时候,经常会...有很多命令语句,如:awk,sed都可以做字符串各种操作。 其实shell内置一系列操作符号,可以达到类似效果,大家知道,使用内部操作符会省略启动外部程序等时间,因此速度会非常的快。
前段时间和几位同事讨论过一个问题:Shell脚本里面怎样把一个数组传递到awk内部进行处理? 当时没有找到方法。前两天在QQ群里讨论awk的时候,无意间又聊起这个话题。机缘巧合之下找到一个思路,特此分享。 测试环境...
该文档介绍了shell编程中对字符串处理的一些基本命令, 如sed, cut, awk等等
一、Gnu Linux shell 截取字符变量的前8位,有方法如下: 1.expr substr “$a” 1 8 ...${varible##*string} 从左向右截取最后一个string后的字符串 ${varible#*string}从左向右截取第一个string后的字符串 ${varible%
本文实例讲述了php实现字符串反转输出的方法。... 您可能感兴趣的文章:php实现字符串翻转的方法利用perl、python、php、shell、sed、awk、c 实现字符串的翻转php中实现字符串翻转的方法PHP 实现字符串翻转(包含
前言 我们在日常工作中,对于求字符串操作在shell...【方法三】:利用awk的NF项来获取字符串长度 备注: -F为分隔符,NF为域的个数,即单行字符串的长度 【方法四】:利用wc的-L参数来获取字符串的长度 备注: -L参数
变量无类型之分 (Typeless), 可使用文字当数组的下标(Associative Array)...等特色. 因此, 使用awk撰写程序比起 使用其它语言更简洁便利且节省时间. awk还具有一些内建功能, 使得awk擅于处理具数据行 (Record), ...