Home Page   #vim  #kubuntu  #slackware  #freebsd  #debian  #linux  #gentoo  #fedora  #ubuntu  #compiz-fusion  #bash  #suse  
Reliable $1 Web Hosting by 3iX

Channels


#bash

02 January 2008


Total 15 pages. You are browsing page 1/15.

First :: Prev :: [1] [2] [3] [4] [5] [...] :: Next :: Last

--- Log opened Wed Jan 02 00:00:06 2008
00:02 <****> ak5_: %what: "What are you trying to do?"
00:02 <****> how would I store the first line of output from tar -xzvf?
00:03 <****> Hey everyone!
00:03 <****> or determine the parent directory in a tar.gz
00:04 <****> I have a silly awk question! I can use awk to take line seperated data and work on each row (or select a column from each row), though suppose I have a single line with 10 words (for example), how would I perform an operation to each word?
00:04 <****> wormz: awk '{ command }'
00:06 <****> go|dfish: yeah I'm not sure which though. say the line contained "A B C D" and I wanted the script to print "number-A" "number-B" "number-C" "number-D" on seperate lines?
00:06 <****> go|dfish: I guess it's some "foreach in $0" within the awk script?
00:07 <****> A for loop, yeah.
00:07 <****> The only thing I could think of to get the first line of output is to pipe it into a while loop and short circuit after one iteration... there must be a better way
00:07 <****> octoberdan: blah | head -1
00:08 <****> jesus...
00:08 <****> Thanks
00:10 <****> can you add recursivity to wc?
00:10 <****> no, combine it with find
00:10 <****> !find
00:10 <****> http://wooledge.org/mywiki/UsingFind
00:11 <****> go|dfish: Thank you for the help
00:11 <****> octoberdan: No problem.
00:11 <****> why they don't teach this at school
00:11 <****> how to use find
00:12 <****> Heheh
00:12 <****> and religion they teach
00:12 <****> what is wrong with ppl
00:12 <****> hmmm... I'm trying to decompress a tar and then cd into its parent directory. I've tried "tar -xzvf proj.tar.gz | head -1 | xargs cd" but that is giving me a "xargs: cd: No such file or directory
00:13 <****> the root of the stuff decompressed... not parent, blah.
00:14 <****> Is it possible to pipe to cd like I'm doing?
00:14 <****> no. cd "$(tar blah | head -1)"
00:14 <****> go|dfish: I worked out the script to put in a file as a for loop ("for T in A B C\n do \n echo $T \n done") though I want to make it in one line for the terminal, could I get a hand with that?
00:14 <****> doh...
00:14 <****> if tar doesn't stop decompressing when head ends
00:15 <****> !regex
00:15 <****> Some people, when confronted with a problem, think ``I know, I'll use regular expressions.'' Now they have two problems. -- jwz
00:15 <****> ...ok... P
00:15 <****> wormz: replace the \n with ; , except after do
00:15 <****> javaJake: /topic #regex
00:15 <****> Thanks, go|dfish :P
00:16 <****> koala_man: Excellent!! Thanks mate.
00:17 <****> find . -type f -mtime +30 -exec rm -f {} \;
00:17 <****> then how do you pipe to exec?
00:17 <****> if you wanna do something more complex
00:17 <****> you can't even add "" to it
00:17 <****> like -exec "rm -r {}"
00:18 <****> i wanna do first grep and then wc -l for each file it finds
00:19 <****> Cr3ature: pipe find to wc -l
00:20 <****> Thanks again guys
00:20 <****> go|dfish: wtf
00:21 <****> Cr3ature: oh, you want a separate count for each file?
00:21 <****> I think I'd stop using computers before going back to Windows
00:21 <****> yes
00:21 <****> but i want count for only lines that match certain regexp
00:21 <****> Cr3ature: I guess you could just exec 'grep -c'
00:23 <****> i wanna: grep "foobar" | wc -l
00:23 <****> for each file in the directory recursively
00:23 <****> and the tutorial only tels how to exec one command for findings
00:24 <****> just exec grep -c "foobar" instead
00:25 <****> and how do i get sum?
00:25 <****> !faq sum
00:25 <****> http://wooledge.org/mywiki/BashFAQ/076 -- How do I get the sum of all the numbers in a column?
00:26 <****> Although if you just want the total, you could do it all in awk.
00:26 <****> i pipe that
00:26 <****> eh, you dont
00:26 <****> nevermind
00:26 <****> otherwise you'd be using wc -l, d'oh
00:27 <****> wtf is "myfile"
00:28 <****> destination or target
00:42 <****> what would be an appropriate way of checking if theres a .rar or .r01-file in a directory?
00:43 <****> extglob, maybe.
01:08 <****> how can i check if a word is in mtab?
01:09 <****> grep
01:10 <****> i meant like in a script
01:10 <****> There's nothing stopping you from using grep in a script.
01:11 <****> if grep -q word /etc/mtab; then echo yes && exit 0 ; else echo no && exit 1 ; fi maybe that's what about what you're looking for
01:11 <****> er...
01:12 <****> yeah, that's it ;D ty ty
01:12 <****>
01:38 <****> how can i change the first letter of a string to lowercase? ;p
01:38 <****> or the whole string, doesn't matter
01:38 <****> tr
01:38 <****> oh, sweet!
01:39 <****> hmm..
03:01 <****> y0
03:02 <****> !y0
03:02 <****> m00, TheBonsai ;-)
03:04 <****> "good morning" igli
03:04 <****> hehe hi TheBonsai :D
03:05 <****> http://bux.to/?r=ikichi it's really cool
03:07 <****> ad...
03:35 * man_in_shack waves
03:45 <****> LSD did not come out of Berkeley
03:45 <****> It came from Albert Hoffman's lab in Switzerland
03:45 <****> part of some drug's company I think
03:47 <****> BitTorrent came out of some guys apartment living in Berkeley
04:44 <****> I'm trying to put a command to execute into a variable, and then execute that variable. I have done this before with simple commands successfully, but it is failing on a command containing a piper. I am doing:
04:44 <****> $backuploc"
04:45 <****> $cmd && echo ", ok." || echo ", FAILED."
04:45 <****> running with bash -x shows:
04:45 <****>' /data/backups/data_zones_www1@081207_020108.bz2
04:45 <****> too many arguments


Total 15 pages. You are browsing page 1/15.

First :: Prev :: [1] [2] [3] [4] [5] [...] :: Next :: Last