Newb looking for awk help.
Newb looking for awk help.
(OP)
Hi ,
i'm not a programmer , just want to eddit abit old script that left up.
i need a function can filter up those unwanted part in a text file with a input.
it will delete those section that i'm giving in input file.
Exp:
file i need to modify:
-------------------------------------------------------
Start1A
contents
end
Start2B
contents
end
Start3C
contents
end
-------------------------------------------------------
input file:
1A
3C
-------------------------------------------------------
output file:
Start2
contents
end
-------------------------------------------------------
i'm not a programmer , just want to eddit abit old script that left up.
i need a function can filter up those unwanted part in a text file with a input.
it will delete those section that i'm giving in input file.
Exp:
file i need to modify:
-------------------------------------------------------
Start1A
contents
end
Start2B
contents
end
Start3C
contents
end
-------------------------------------------------------
input file:
1A
3C
-------------------------------------------------------
output file:
Start2
contents
end
-------------------------------------------------------
RE: Newb looking for awk help.
Something like this ?
CODE --> command line
Feherke.
feherke.ga
RE: Newb looking for awk help.
Thank for answer, i'm try, but can't .
if not mistake I just got normal awk.
the output come out all what from file-to-modify
RE: Newb looking for awk help.
I used exactly the samples you posted earlier. Are you sure they are correct ? ( Note that by default Awk matches case sensitively. )
You are using it on a Unix or Unix-like operating system, right ?
Feherke.
feherke.ga
RE: Newb looking for awk help.
Chris.
Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum
RE: Newb looking for awk help.
i'm using window base .
i try modify the file name to single name to reduce mistake, but still same.
RE: Newb looking for awk help.
By the way, "transposed" means 'wrong way around' or 'swapped places' nothing to do with length but IF your file names have spaces in them you need to wrap them in quotes.
Chris.
Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum
RE: Newb looking for awk help.
I met Windows users in the past who experienced problems with Awk. Try to put the Awk code in a file and execute it like this :
CODE --> command line
Feherke.
feherke.ga
RE: Newb looking for awk help.
Thank for response.
i'm not familiar with awk.
i'm using kornshell for run it.
i try it but the error as below:
$ kttan84.awk
C:/NuTCROOT/mksnt/awk.exe: Syntax error Context is:
>>> D: <<<
RE: Newb looking for awk help.
Sadly I am not familiar with MKS Toolkit, but if it provides a genuine KSh in a fully set up POSIX environment ( just like CygWin does ), then the command as I posted earlier should work as is.
What you get if you run awk -W version from the command line ? What you put in the kttan84.awk file ?
Feherke.
feherke.ga
RE: Newb looking for awk help.
i check the exe for awk.exe as attachment.
RE: Newb looking for awk help.
Well, not a big problem, the -W option is not standard, but some implementations have it.
So far I would still expect the command I posted on 20 Jan 16 12:20 should work.
When answering my other question, "What you put in the kttan84.awk file ?", please also post the output of the which awk command.
Feherke.
feherke.ga
RE: Newb looking for awk help.
Hi ,
what i put is in the file are as below, i try remove the master too, it still can't.
file name as (kttan84.awk)
-------------------------------------------------------------------------
master # cat kttan84.awk
FNR==NR{s=s (s?"|":"")$0;next}$0~"^Start("s")$",/^end$/{next}1
master # awk -f kttan84.awk input-file.txt file-to-modify.txt
-------------------------------------------------------------------------
RE: Newb looking for awk help.
To be able to execute kttan84.awk like that(*), it must include a shebang :
CODE --> kttan84.awk
(*) Of course, the above applies to Unix and Unix-like systems, including CygWin. Not sure about MKS Toolkit.
Feherke.
feherke.ga
RE: Newb looking for awk help.
You are aware that "master #" is not part of the command line, but is the 'command prompt' on feherke's terminal window.
Chris.
Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum
RE: Newb looking for awk help.
cool it work . thank you.
may i know how it function ? coz i need modify it for my program, those i give a an simple example , in actual file have include spacebar and symbol, i want learn some, it look fun, although im not programmer.
FNR==NR{s=s (s?"|":"")$0;next}$0~"^Start("s")$",/^end$/{next}1
RE: Newb looking for awk help.
CODE --> Awk
Feherke.
feherke.ga