Linux2019. 9. 2. 17:51

명령행으로 묶은 다음 그걸 전체로 리다이렉션 하면 되는 구나..

 

{ tail --lines=+7 text1; cat text2; } > out_put 

[링크 : https://stackoverflow.com/questions/20499969/combining-cat-and-tail]

'Linux' 카테고리의 다른 글

awk 변수 지정  (0) 2019.09.02
awk 치환(삭제)  (0) 2019.09.02
awk 구분자 탭으로 인식시키기  (0) 2019.09.02
awk 특정 열 제외하기  (0) 2019.09.02
linux 수동 trim  (0) 2019.08.16
Posted by 구차니

\! pwd

 

그냥 외부 명령어 실행해서 확인하는 듯..

[링크 : https://stackoverflow.com/questions/45091269/how-to-print-current-working-directory-in-psql-console]

Posted by 구차니
Linux2019. 9. 2. 15:30

-F '\t' 

[링크 : https://kldp.org/node/120883]

 

-F fs
--field-separator fs
Use fs for the input field separator (the value of the FS predefined variable).

[링크 : https://linux.die.net/man/1/awk]

 

+

출력은 탭으로 안되는데(기본값이 스페이스)

OFS

The output field separator, a space by default.

 

여러번 시도해보니.. awk'{}' OFS='\t'만 먹는다. 환경변수로 인식을 하는 듯?

awk '{split($5,a,"-"); print $1,$2,$3,a[1]}' OFS='\t' file.bed > test.bed

[링크 : https://www.unix.com/shell-programming-and-scripting/264368-awk-output-seperated-tab.html]

 

+

$ cat filename | awk -F '\t' '{$2="";print $0;}' OFS='\t' | sed 's/<.*//'

두번째 값을 날리고, 끝에 탭이 하나씩 남아서 따라오는걸 없애는 법 (두번째가 마지막 column이라고 가정)

[링크 : https://askubuntu.com/questions/232606/stdout-string-manipulate-delete-all-after-a-word-per-line]

 

+

끝이 스페이스로 끝날때 날리기

sed -i 's/[[:space:]]*$//' <name-of-file.ldif>

[링크 : https://www.theurbanpenguin.com/remove-trailing-spaces-using-sed/]

'Linux' 카테고리의 다른 글

awk 치환(삭제)  (0) 2019.09.02
tail과 cat 합치기  (0) 2019.09.02
awk 특정 열 제외하기  (0) 2019.09.02
linux 수동 trim  (0) 2019.08.16
jq - json in linux command line  (0) 2019.08.16
Posted by 구차니
Linux2019. 9. 2. 13:03

아래는 3번과 5번에 대해서 열을 날리는 예제

 

$ cat temp.txt | awk '{$3=$5=""; print $0}'

C1 C2  C4  C6 C7 C8 C9 C10

[링크 : https://ondemand.tistory.com/238]

 

+

단, 구분자를 제외하고 날리기 때문에 하나의 빈 구분자가 추가되는 식으로 출력되니 주의

'Linux' 카테고리의 다른 글

tail과 cat 합치기  (0) 2019.09.02
awk 구분자 탭으로 인식시키기  (0) 2019.09.02
linux 수동 trim  (0) 2019.08.16
jq - json in linux command line  (0) 2019.08.16
awk NR, NF  (0) 2019.08.12
Posted by 구차니

그런거 없다~ -_ㅠ

 

아무래도.. awk의 힘을 빌려야 할 듯..

[링크 : https://stackoverflow.com/questions/26701735/]

'프로그램 사용 > postgreSQL' 카테고리의 다른 글

pg_restore  (0) 2019.09.03
postgresql working directory  (0) 2019.09.02
postgresql \copy에서 시작 몇줄 무시하기  (0) 2019.09.02
postgresql custom database dump 복구하기  (0) 2019.09.02
postgresql generate_series()  (0) 2019.08.28
Posted by 구차니

그런거 없다 -_-

tail -n+3을 통해서 앞의 3줄을 날리고 하는걸 추천하는 듯...

 

tail -n+3 myfile.csv

[링크 : https://stackoverflow.com/questions/37368845/postgresql-copy-skip-first-two-lines-off-csv]

'프로그램 사용 > postgreSQL' 카테고리의 다른 글

postgresql working directory  (0) 2019.09.02
postgresql \copy에서 컬럼 무시하기  (0) 2019.09.02
postgresql custom database dump 복구하기  (0) 2019.09.02
postgresql generate_series()  (0) 2019.08.28
where 1=1  (4) 2019.08.27
Posted by 구차니

 

 

export
pg_dump -U db_user -W -F t db_name > /path/to/your/file/dump_name.tar

import
pg_restore -d db_name /path/to/your/file/dump_name.tar -c -U db_user

[링크 : https://axiomq.com/blog/backup-and-restore-a-postgresql-database/]

 

[링크 : https://www.postgresql.org/docs/9.4/backup-dump.html]

[링크 : https://www.postgresql.org/docs/8.1/backup.html]

[링크 : https://www.postgresql.org/docs/8.1/app-pgrestore.html]

'프로그램 사용 > postgreSQL' 카테고리의 다른 글

postgresql \copy에서 컬럼 무시하기  (0) 2019.09.02
postgresql \copy에서 시작 몇줄 무시하기  (0) 2019.09.02
postgresql generate_series()  (0) 2019.08.28
where 1=1  (4) 2019.08.27
join  (0) 2019.08.27
Posted by 구차니

야근의 스멜인가?

'개소리 왈왈 > 직딩의 비애' 카테고리의 다른 글

체불 퇴직금 신고  (0) 2019.09.19
추석 전날 피곤..  (2) 2019.09.12
이번달도 끝  (0) 2019.08.31
모니터 갯수와 집중도의 반비례 관계...?  (2) 2019.08.30
내일은 광복절..  (0) 2019.08.14
Posted by 구차니