find 명령 쓸때요 grep 이용해서 걸러 낼려고 하는데요.

kknd345의 이미지

예를 들어

find / -name *.txt*

이렇게 했는데요

find : /var/xxxx1: Permission denied
find : /var/xxxx2: Permission denied
find : /var/xxxx3: Permission denied
find : /var/xxxx4: Permission denied
find : /var/xxxx5: Permission denied
find : /var/xxxx6: Permission denied
find : /var/xxxx7: Permission denied
find : /var/xxxx8: Permission denied
find : /var/xxxx9: Permission denied

이런거 때문에 find 한거 찾기가 무척 힘들거든요..

저 내용 안 보이게 할려면 어떻게 해야 해요?

grep 나 /dev/null 어떻게 하면 될것도 같은데...
계속 안 되네요 ㅜㅜ...

prolinko의 이미지

find / -name *.txt* 2> /dev/null

thisrule의 이미지

find / -name *.txt* | grep -v "Permission denied"

kknd345의 이미지

답변 고맙습니다.

그런데 의미 분석좀 해주세요...

find / -name *.txt* 2> /dev/null 여기서 2> 이부분 이랑

find / -name *.txt* | grep -v "/dev/null""/dev/null" 이건 왜 따옴표로 묶었어요?

1%의 가능성이면 충분하다!
최선을 다하자!

preisner의 이미지

Quote:
find / -name *.txt* 2> /dev/null
여기서 2> 이부분 이랑

에러 출력은 /dev/null로. (버리라는 뜻이죠.)
참고로
1> 은 표준 출력.
2>&1 은 에러 출력은 표준 출력(1)과 동일하게.

Quote:
find / -name *.txt* | grep -v "/dev/null""/dev/null" 이건 왜 따옴표로 묶었어요?

grep 이 따옴표로 묶으면 글자 그대로 해석하고
안 묶을 경우 정규표혁식으로 해석합니다.
ytt123의 이미지

find / -name "myfile.out" 2>/dev/null 라고 치면,
다음과 같은 에러가 생기는군요....ㅠㅠ

find: paths must precede expression
Usage: find [path...] [expression]

bash에서는 잘 되는데, csh에서는 위와 같은 메세지가 뜨는데...어케 해결해야 하나요?

doodoo의 이미지

제가 이해 하기로는 스텐다드에러에 관해서는 /dev/null 로 보내서 보기 않는것이 목적인것 같
은데요......

http://linuxdevcenter.com/pub/a/linux/lpt/13_01.html
여기 링크에 작은 표가 하나 있는데...

그중

기능                 | csh      |      sh
-------------------------------------------------
Send stderr to file  |		| prog 2> file
--------------------------------------------------

이렇게 되어 있네요...ㅎㅎ 즉 씨쉘에서는 그 기능이 없다 같습니다.
근데...스텐다스 아웃과 스텐다드 에러를 같이 파일로 내보내는 기능은 있군요..
 기능                                 |       씨쉘      |       쉘
-------------------------------------------------------------------------
Send stdout and stderr to end of file |	prog >>& file	| prog >> file 2>&1

즉.....prog >>& file 게 써라 같군요...

저도 참 업무로 쓰던 썬, 알파, 옥테인(mips꺼) 등에서 모두 csh 를 쓰다가 개인적인
집에서만 bash 를 썼었는데(이제 사무실도 리눅스로 통일되어가니...) 어떻게 잘
버텼는지...ㅎㅎㅎㅎ
그렇다고 꼭 csh 이 나쁘다는 것은 아닙니다...^^

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.