04-17-2008
Can you explain the logic as I am new to AWK
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I have a text file with following content (3 lines)
filename : output.txt
first line:12/12/2008
second line:12/12/2008
third line:Y
I would like to know how we can replace 'Y' with 'N' in the 3rd line keeping 1st and 2nd lines same as what it was before.
I tried using cat output.txt... (4 Replies)
Discussion started by: santosham
4 Replies
2. Shell Programming and Scripting
I am trying to use sed to replace specific characters at a specific position in the file with a different value... can this be done?
Example:
File:
A0199999123
A0199999124
A0199999125
Need to replace 99999 in positions 3-7 with 88888.
Any help is appreciated. (5 Replies)
Discussion started by: programmer22
5 Replies
3. Shell Programming and Scripting
I'm drawing a blank on how to use sed to replace selectively based on position in the string (vs nth occurence):
hello.|there.|how.|are.|you.|
I want the period removed in the 3rd item (as defined by the pipe delimiter) if a period is present. So the result in this case would be:
... (2 Replies)
Discussion started by: tiggyboo
2 Replies
4. Shell Programming and Scripting
Hello
i have a text file like this:
1 AB AC AD EE
2 WE TR YT WW
3 AS UY RF YT
the file is bigger , but that's an example of the data
what i want to do is to merge all columns together except the first one,
it will become like this :
1 ABACADEE
2 WETRYTWW
3 ASUYRFYT (8 Replies)
Discussion started by: shelladdict
8 Replies
5. UNIX for Dummies Questions & Answers
I have a space delimited text file with 1,000,000+ columns? I would only like to view specific ones (let's say through 1:10), how can I do that? Thanks! (3 Replies)
Discussion started by: evelibertine
3 Replies
6. Shell Programming and Scripting
I asked this before, but my problem got more complicated. Heres what I am trying to do:
I'm trying to replace a string at a certain location with another string.
Heres the file I'm trying to change:
\E
I want to replace the escape code at the 3rd line, 2nd column with this escape code... (3 Replies)
Discussion started by: tinman47
3 Replies
7. Shell Programming and Scripting
How to replace the position specific values in the file..
i searched a lot the forums but i couldn't able to do...
i have file like below
576666666666666666666666666 7878 897987 121 0asdas Y12
5900fbb 777 09JJJ 78798347892374 234234234364 234232898
89HJHIHIGIUG989902743748327khjkhkjlh... (6 Replies)
Discussion started by: greenworld123
6 Replies
8. Shell Programming and Scripting
Need command for position based replace:
I need a command to replace with 0 for characters in the positions 11 to 20 to all the lines starts with 6 in a file.
For example the file ABC.txt has:
abcdefghijklmnopqrstuvwxyz
6abcdefghijklmnopqrstuvwxyz
abcdefghijklmnopqrstuvwxyz... (4 Replies)
Discussion started by: thangabalu
4 Replies
9. Shell Programming and Scripting
Hi Experts,
I have a tab deliminated file as below
myfile.txt
Local Group Memberships *Administrators *Guests
I need data in below format starting from 4th position.
myfile1.txt
Administrators Guests
the above one is just an example and there could... (15 Replies)
Discussion started by: Litu1988
15 Replies
10. Post Here to Contact Site Administrators and Moderators
In file, we have millions of records each of 1000 in length. And at specific position say 800 there is a space, we need to replace it with Character X if the ID in that row starts with 123.
So far i have used the below which is replacing space at that position to X but its not checking for... (3 Replies)
Discussion started by: Jagmeet Singh
3 Replies
LEARN ABOUT DEBIAN
dpkg-awk
DPKG-AWK(1) General Commands Manual DPKG-AWK(1)
NAME
dpkg-awk - Utility to read a dpkg style db file
SYNOPSIS
dpkg-awk [(-f|--file) filename] [(-d|--debug) ##] [(-s|--sort) list] [(-rs|--rec_sep) ??] '<fieldname>:<regex>' ... -- <out_fieldname> ..
DESCRIPTION
dpkg-awk Parses a dpkg status file (or other similarly formatted file) and outputs the resulting records. It can use regex on the field
values to limit the returned records, it can also be told which fields to output, and it can sort the matched fields.
OPTIONS
-f filename
--file filename
The file to parse. The default is /var/lib/dpkg/status.
-d [#]
--debug [#]
Each time this is specified, it increased the debug level.
-s field(s)
--sort field(s)
A space or comma separated list of fields to sort on.
-n field(s)
--numeric field(s)
A space or comma separated list of fields that should be interpreted as numeric in value.
-rs ??
--rec_sep ??
Output this string at the end of each output paragraph.
-h
--help Display some help.
fieldname
The fields from the file, that are matched with the regex given. The fieldnames are case insensitive.
out_fieldname
The fields from the file, that are output for each record. If the first field listed begins with ^, then the list of fields that
follows will NOT be output.
BUGS
Be warned that the author has only a shallow understanding of the dpkg packaging system, so there are probably tons of bugs in this pro-
gram.
This program comes with no warranties. If running this program causes fire and brimstone to rain down upon the earth, you will be on your
own.
This program accesses the dpkg database directly in places, querying for data that cannot be gotten via dpkg.
AUTHOR
Adam Heath <doogie@debian.org>
DEBIAN
Debian Utilities DPKG-AWK(1)