#!/bin/sh
SHMID=`ipcs -m | grep $USER | cut -d " " -f2`
SEMID=`ipcs -s | grep $USER | cut -d " " -f2`
MSQID=`ipcs -q | grep $USER | cut -d " " -f2`
for shm in $SHMID
do
ipcrm -m $shm
done
for sem in $SEMID
do
ipcrm -s $sem
done
for msq in $MSQID
do
ipcrm -q $msq
done
2017년 12월 18일 월요일
2017년 4월 4일 화요일
[리눅스,유닉스] 공백이나 특수문자 등으로 시작하는 파일 지우기
종종 시스템에 웃지 못할 파일이 있는 경우
즉, 공백이나 특수문자, 혹은 - 문자로 시작하는 파일도 지울 수 없을 때 사용
$ ls -ltri
702887 -rw-r--r-- 1 perf users 566 Apr 5 08:06 perftest.sh
630368 -rw-r--r-- 1 perf users 2252 Apr 5 08:07 compare.sh
702892 drwxrwxrwx 8 perf users 1024 Apr 5 08:07 work
5486485 -rw-rw-rw- 1 perf users 566 Apr 5 08
5486498 -rw-r--r-- 1 perf users 35200 Apr 5 09:31 perf.tar
$ find . -inum 5486485 -exec rm -f {} \;
$ ls -ltri
702887 -rw-r--r-- 1 perf users 566 Apr 5 08:06 perftest.sh
630368 -rw-r--r-- 1 perf users 2252 Apr 5 08:07 compare.sh
702892 drwxrwxrwx 8 perf users 1024 Apr 5 08:07 work
5486498 -rw-r--r-- 1 perf users 35200 Apr 5 09:31 perf.tar
즉, 공백이나 특수문자, 혹은 - 문자로 시작하는 파일도 지울 수 없을 때 사용
$ ls -ltri
702887 -rw-r--r-- 1 perf users 566 Apr 5 08:06 perftest.sh
630368 -rw-r--r-- 1 perf users 2252 Apr 5 08:07 compare.sh
702892 drwxrwxrwx 8 perf users 1024 Apr 5 08:07 work
5486485 -rw-rw-rw- 1 perf users 566 Apr 5 08
5486498 -rw-r--r-- 1 perf users 35200 Apr 5 09:31 perf.tar
$ find . -inum 5486485 -exec rm -f {} \;
$ ls -ltri
702887 -rw-r--r-- 1 perf users 566 Apr 5 08:06 perftest.sh
630368 -rw-r--r-- 1 perf users 2252 Apr 5 08:07 compare.sh
702892 drwxrwxrwx 8 perf users 1024 Apr 5 08:07 work
5486498 -rw-r--r-- 1 perf users 35200 Apr 5 09:31 perf.tar
2017년 3월 20일 월요일
Query exercise
직업별 컬럼을 생성하여 정리하되 doctor, professor, singer, actor순서로 정렬하며
각 컬럼은 alpabet 오름 차순으로 정렬
Data
iSQL> select * from occupations;
NAME OCCUPATION
-----------------------------------------------
Ashley Professor
Samantha Actor
Julia Doctor
Britney Professor
Maria Professor
Meera Professor
Priya Doctor
Priyanka Professor
Jennifer Actor
Ketty Actor
Belvet Professor
Naomi Professor
Jane Singer
Jenny Singer
Kristeen Singer
Christeen Singer
Eve Actor
Aamina Doctor
18 rows selected.
Output
DOCTOR PROFESSOR SINGER ACTOR
---------------------------------------------------------------------------------------------
Aamina Ashley Christeen Eve
Julia Belvet Jane Jennifer
Priya Britney Jenny Ketty
Maria Kristeen Samantha
Meera
Naomi
Priyanka
7 rows selected.
문제 출처: hackerrank
My Answer
select doctor, professor, singer, actor from
(
select rownum rown from (select name as doctor from occupations where occupation = 'Doctor' order by name)
union
select rownum rown from (select name as professor from occupations where occupation = 'Professor' order by name)
union
select rownum rown from (select name as singer from occupations where occupation = 'Singer' order by name)
union
select rownum rown from (select name as actor from occupations where occupation = 'Actor' order by name)
) main,
(select rownum rown, doctor from (select name as doctor from occupations where occupation = 'Doctor' order by name)) a,
(select rownum rown, professor from (select name as professor from occupations where occupation = 'Professor' order by name)) b,
(select rownum rown, singer from (select name as singer from occupations where occupation = 'Singer' order by name)) c,
(select rownum rown, actor from (select name as actor from occupations where occupation = 'Actor' order by name)) d
where main.rown=a.rown(+)
and main.rown=b.rown(+)
and main.rown=c.rown(+)
and main.rown=d.rown(+);
각 컬럼은 alpabet 오름 차순으로 정렬
Data
iSQL> select * from occupations;
NAME OCCUPATION
-----------------------------------------------
Ashley Professor
Samantha Actor
Julia Doctor
Britney Professor
Maria Professor
Meera Professor
Priya Doctor
Priyanka Professor
Jennifer Actor
Ketty Actor
Belvet Professor
Naomi Professor
Jane Singer
Jenny Singer
Kristeen Singer
Christeen Singer
Eve Actor
Aamina Doctor
18 rows selected.
Output
DOCTOR PROFESSOR SINGER ACTOR
---------------------------------------------------------------------------------------------
Aamina Ashley Christeen Eve
Julia Belvet Jane Jennifer
Priya Britney Jenny Ketty
Maria Kristeen Samantha
Meera
Naomi
Priyanka
7 rows selected.
문제 출처: hackerrank
My Answer
select doctor, professor, singer, actor from
(
select rownum rown from (select name as doctor from occupations where occupation = 'Doctor' order by name)
union
select rownum rown from (select name as professor from occupations where occupation = 'Professor' order by name)
union
select rownum rown from (select name as singer from occupations where occupation = 'Singer' order by name)
union
select rownum rown from (select name as actor from occupations where occupation = 'Actor' order by name)
) main,
(select rownum rown, doctor from (select name as doctor from occupations where occupation = 'Doctor' order by name)) a,
(select rownum rown, professor from (select name as professor from occupations where occupation = 'Professor' order by name)) b,
(select rownum rown, singer from (select name as singer from occupations where occupation = 'Singer' order by name)) c,
(select rownum rown, actor from (select name as actor from occupations where occupation = 'Actor' order by name)) d
where main.rown=a.rown(+)
and main.rown=b.rown(+)
and main.rown=c.rown(+)
and main.rown=d.rown(+);
피드 구독하기:
글 (Atom)
리눅스 문자와숫자 조합의 파일이름 정렬( Sort alphanumeric filenames in Linux )
아래 처럼 문자와 숫자가 섞여 있는 파일에 대해서 정렬이 제대로 되지 않을 때 When sorting is not done properly for files with mixed letters and numbers as shown below [codeh...
-
우선 메뉴에서 Tools아래 Orange Options를 선택 후 Common의 Session에서 Commit automatically after every statement를 체크하면 Autocommit is On으로 변경됨 ...
-
1. 하드웨어 시간 확인 #> hwclock -r 2. 소프트웨어 시간 확인 $, #> date 3. 자동 설정 #> rdate -s time.bora.net 4.수동 설정 #> date -s "201...
-
오라클 설치를 하였으니 테스트용으로 HR 샘플 스키마를 설치한다. oracle@solaris:~$ sqlplus sys as sysdba Connected to: SQL*Plus: Release 18.0.0.0.0 - Producti...