我有一个Element_query包含查询结果的文件:
SQL> select count (*) from element;
[Output of the query which I want to keep in my file]
SQL> spool off;
Run Code Online (Sandbox Code Playgroud)
我想使用 shell 命令删除第一行和最后一行。
我的档案,
PSS-A (Primary A)
PSS-B (Primary B)
PSS-C (Primary C)
PSS-D (Primary D)
PSS-E (Primary E)
PSS-F (Primary F)
PSS-G (Primary G)
PSS-H (Primary H)
PSS-I (Primary I)
SPARE (SPARE)
Run Code Online (Sandbox Code Playgroud)
输出文件,
1> PSS-A (Primary A)
2> PSS-B (Primary B)
3> PSS-C (Primary C)
4> PSS-D (Primary D)
5> PSS-E (Primary E)
6> PSS-F (Primary F)
7> PSS-G (Primary G)
8> PSS-H (Primary H)
9> PSS-I (Primary I)
10> SPARE (SPARE)
Run Code Online (Sandbox Code Playgroud) 文件:
Data inserted into table. Total count 13
No error occurred
Data inserted into table. Total count 45
No error occurred
Data inserted into table. Total count 14
No error occurred
Data inserted into table. Total count 90
No error occurred
Run Code Online (Sandbox Code Playgroud)
预期输出文件:
Data inserted into table. Total count 13
Data inserted into table. Total count 45
Data inserted into table. Total count 14
Data inserted into table. Total count 90
Run Code Online (Sandbox Code Playgroud)
我希望输出看起来像这样:每隔一行将被删除,但行之间不会有间隙。
输入:
ARCHIVE B1_NAME B2_NAME B3_NAME ELEMENT INFO_NAM WERT PROCID
-------- -------- -------- -------- -------- -------- ---- ------
15MinAvg AIRSS 33-GIS DMDMGIS1 I MvAvr15m 1123 CP
15MinAvg AIRSS 33-GIS DMDMGIS1 P MvAvr15m 2344 CP
15MinAvg AIRSS 33-GIS DMDMGIS1 Q MvAvr15m 4545 CP
15MinAvg AIRSS 33-GIS DMDMGIS2 I MvAvr15m 6576 CP
15MinAvg AIRSS 33-GIS DMDMGIS2 P MvAvr15m 4355 CP
15MinAvg AIRSS 33-GIS DMDMGIS2 Q MvAvr15m 6664 CP
Run Code Online (Sandbox Code Playgroud)
输出:
ARCHIVE B1_NAME B2_NAME B3_NAME ELEMENT WERT
-------- -------- -------- -------- ------- ----
15MinAvg AIRSS …Run Code Online (Sandbox Code Playgroud) 我想删除文件中每行的第 5 个单词。
文件的当前内容:
File is not updated or and will be removed
System will shut down f within 10 seconds
Please save your work 55 or copy to other location
Kindly cooperate with us D
Run Code Online (Sandbox Code Playgroud)
预期输出:
File is not updated and will be removed
System will shut down within 10 seconds
Please save your work or copy to other location
Kindly cooperate with us
Run Code Online (Sandbox Code Playgroud) 文件,
.false alarm is bla no. 11
.no alarm generated is bla
.application will be killed is bla wall command
.doc file is document file with .doc extension
.no authority for this selection bla
Run Code Online (Sandbox Code Playgroud)
现在我想在我的输出文件中打印只包含单词的行bla(或者它也可能是数字)
输出将是这样的,
1 .false alarm is bla no. 11
2 .no alarm generated is bla
3 .application will be killed is bla wall command
5 .no authority for this selection bla
Run Code Online (Sandbox Code Playgroud) 文件1:
.tid.setnr := 1123
.tid.setnr := 3345
.tid.setnr := 5431
.tid.setnr := 89323
Run Code Online (Sandbox Code Playgroud)
文件2:
.tid.info := 12
.tid.info := 3
.tid.info := 44
.tid.info := 60
Run Code Online (Sandbox Code Playgroud)
输出文件:
.tid.info := 12
.tid.setnr := 1123
.tid.info := 3
.tid.setnr := 3345
.tid.info := 44
.tid.setnr := 5431
.tid.info := 60
.tid.setnr := 89323
Run Code Online (Sandbox Code Playgroud) 我想在 cronjob 中放置一个脚本,该脚本将在特定时间运行,如果文件数超过 60,它将从该文件夹中删除最旧的文件。后进先出。我试过了,
#!/bin/ksh
for dir in /home/DABA_BACKUP
do
cd $dir
count_files=`ls -lrt | wc -l`
if [ $count_files -gt 60 ];
then
todelete=$(($count_files-60))
for part in `ls -1rt`
do
if [ $todelete -gt 0 ]
then
rm -rf $part
todelete=$(($todelete-1))
fi
done
fi
done
Run Code Online (Sandbox Code Playgroud)
这些都是每天保存并命名的备份文件backup_$date。这个可以吗?
我创建了一个别名:
alias shh='sqlplus hfdora/hfdora@hfd1"
Run Code Online (Sandbox Code Playgroud)
创建此别名后,我只能通过键入shh.
但是在关闭我的外壳后,我下次找不到别名了。即使只输入alias,shh也没有显示在列表中。
是否有任何文件可以使别名永久化以使其不会被删除?
我有一台 SUN M3000 服务器。我想将它配置为一个全局区域(名为 z1dms),它将有两个非全局区域(名为 zu9dms 和 zu10dms)。请告诉我如何配置。