find/xargs substiution5437 (2/14/2013 12:00:21 PM) comp.unix.shell If I want to remove all files starting with "foo" in my directory I can do:
find . -name foo.* | xargs rm '{}'
or use -exec. What if I want to rename them to bar.* instead of removing them?
I would no... Ed
modify file with little memory left2439 (2/7/2013 2:18:30 PM) comp.unix.shell If I have a file that's 100G in size and I have 50G memory total left on my
machine, how do I delete the first 5 lines from that file?
I can't manually create a tmp file as I don't have enough memory, simi... Ed
Stop Reading Input Without EOF/nextfile/getline1772 (9/4/2012 8:53:43 PM) comp.lang.awk I was recently trying to answer a question and came across a problem I
don't know if there is an answer to: how can you stop reading from an
input stream without waiting for EOF or invoking getline or (in gaw... Ed
Timed Input9175 (3/9/2012 8:29:49 PM) comp.lang.awk I have a process writing multi-line records to a log file "foo.log". Each record starts with the string "START". I want to be able to tail the log file and extract records that match the text "FOO" while the lo... Ed
parsing multi-line print blocks2173 (1/28/2012 3:13:57 PM) comp.lang.awk The script below will parse an awk script and turn statements like this: print &2" # foo # HERE # would cause "foo" to be printed to stderr. # # 2) Within each block of pre-formatted text only: # a) P... Ed
multi-line print from awk with shell585 (1/23/2012 7:55:36 PM) comp.unix.shell The script below will let you write an awk script that prints multi-line blocks of text. For example: $ epawk -v awkvar="Hello" 'BEGIN{ print "-----------" _print " a multi-line block o... Ed
printing single quotes14104 (1/23/2012 6:48:29 PM) comp.lang.awk I want to print the string 'a' Using \x27 for ' doesn't work as I expected: $ awk 'BEGIN{ print "\x27a\x27" }' z' because (\x27a\x27) is treated as (\x27a)(\x27) instead of (\x27)(a)(\x27). These both... Ed
passing args without eval3253 (1/22/2012 6:21:58 PM) comp.unix.shell Given this test script: $ cat tst.sh function sub { printf '\tsub %s\n' "$@" for subarg do printf '\t subarg = "%s"\n' "$subarg" done } function main { printf 'main %s\n' ... Ed
shell quoting around script output4053 (1/12/2012 6:56:51 PM) comp.unix.shell Can anyone explain exactly why the double quotes around the $(...) command invocation below don't produce the same behavior as double quotes normally do around an awk script: $ awk 'BEGIN{ print "Hello World... Ed
awk here documents13106 (1/11/2012 1:34:42 PM) comp.unix.shell Someone at work asked me how to use a shell here-document inside an awk script called from shell to produce some pre-formatted blocks of code (there's multiple segments that do that inside his code-generator ... Ed
Deduplicate and keep latest date only - sort? awk?5839 (1/6/2013 7:53:46 PM) comp.unix.shell Dear All,
In a dataset with an ID and a date on each line I have one or more dates per ID. I would like to keep only the most recent date. I can sort it easily but have trouble keeping only the latest date.
... wocket(11)
problem using cut with backslash delimiter2134 (1/10/2013 11:47:23 AM) comp.unix.shell Here is a sample of a file, example.txt, containing a few lines of data:
files data=foo {} rel\path\to\01-song_name.ogg
files data=bar {} rel\path\to\02-song_name.ogg
files data=bas {} rel\path\to\03-song_... notvalid7402(9)
Confusion with grep1235 (1/17/2013 4:17:33 PM) comp.unix.shell Hi,
I am using grep to search a file, but my results are a bit weird. The file contains email addresses, like these:
abc_def@yahoo.com
abc_def@yahoo.com
abc.def@yahoo.com
abc.def@yahoo.com
abc.def@ya... artmerar1(28)
Win Shell CMD Under Bash728 (1/19/2013 5:32:36 PM) comp.unix.shell Hi. Could someone give me an example of how to execute the following
Windows shell command -> for /R %b in (*) do chdman copy -i %~pnxb -o
\temp%~pnb <- under bash? TIA.
-- Jurai
... Jurai
modify file with little memory left2439 (2/7/2013 2:18:30 PM) comp.unix.shell If I have a file that's 100G in size and I have 50G memory total left on my
machine, how do I delete the first 5 lines from that file?
I can't manually create a tmp file as I don't have enough memory, simi... mortonspam(827)
find/xargs substiution5437 (2/14/2013 12:00:21 PM) comp.unix.shell If I want to remove all files starting with "foo" in my directory I can do:
find . -name foo.* | xargs rm '{}'
or use -exec. What if I want to rename them to bar.* instead of removing them?
I would no... mortonspam(827)
How to repeat character with awk426 (2/23/2013 10:06:35 AM) comp.unix.shell awk -F, 'BEGIN {print "Наименование
Цена\n-----
--------------------------------------------------------"} {printf
"%-50s %10s\n", $2, $5} {tot+=$5 }; END {print
"--------------------------------... md.kadirov(2)
Add ranks based on scores and handle ties, awk?419 (3/30/2013 4:18:10 PM) comp.unix.shell Dear All,
I have data in two coloumns consisting of ID-numbers and scores. I would like to add the rank on each line based on column 2, and also handle any ties in the scores.
Input, sorted descending by... john.larson.666(7)
piping to fgrep1621 (4/10/2013 8:34:24 AM) comp.unix.shell Is it possible to pipe to fgrep? When I tried, it replies "fgrep: can't o=
pen -"
The input file for the fgrep is actually $0. I grep for all the variable a=
ssignments in the shell script, cut that par... jackshown(62)