03-02-2009
Read from a file then filter the output
Hi
i need a script which reads a certain file and then display it on the screen.
The thing is i need to filter the display output.
this is an example of the file which is to be loaded in the script.
asdfg1.1.1|98
hjkldfe4.0.3|123
asdzxzvdweradfsdafascv10.0.10|123456789
/ar/bl/ew/as/qw/ds/as.bc.19980123.asdfgt14:adfjeiop2.0.3|112356
/dfd/eras/xzcv/asdf/asdf/adsf/a.d.c.19990124.fasdf:adfadf11.12.13|1234
now i want the output to be like this only
asdfg1.1.1|98
hjkldfe4.0.3|123
asdzxzvdweradfsdafascv10.0.10|123456789
19980123.asdfgt14:adfjeiop2.0.3|112356
19990124.fasdf:adfadf11.12.13|1234
how can i do this thing?
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello all,
I need to run snoop command for a period of time (a day) and extract remote host column from it to find out who is accessing my server. When I run the following on the command line it works
snoop -port 22 | awk '{print $3}'
but when I do
snoop -port 22 | awk '{print $3}' | while... (2 Replies)
Discussion started by: afadaghi
2 Replies
2. Shell Programming and Scripting
hi all,
I have this file with some user data.
example:
$cat myfile.txt
FName|LName|Gender|Company|Branch|Bday|Salary|Age
aaaa|bbbb|male|cccc|dddd|19900814|15000|20|
eeee|asdg|male|gggg|ksgu|19911216|||
aara|bdbm|male|kkkk|acke|19931018||23|
asad|kfjg|male|kkkc|gkgg|19921213|14000|24|... (4 Replies)
Discussion started by: srimal
4 Replies
3. Emergency UNIX and Linux Support
<key>ExcludeSimpleHostnames</key>
<integer>0</integer>
<key>FTPPassive</key>
Need simple command that will change the 0 to a 1 in this file when I grep it, but only for this integer key directly after the ExcludeSimpleHostnames key.
I got this output code... (8 Replies)
Discussion started by: glev2005
8 Replies
4. Shell Programming and Scripting
Hi -
I have a file containing data like :-
cn=tommy,cn=users,c=uk
passwordexpirydate=20100530130623z
cn=jane,cn=users,c=uk
passwordexpirydate=20100423140734z
cn=michael,cn=users,c=uk
passwordexpirydate=20100331020044z
I want to end up with a file that looks like:-... (6 Replies)
Discussion started by: sniper57
6 Replies
5. UNIX for Dummies Questions & Answers
Hello-
I am trying to view a file which is quite large. However, whenever I do 'cat (file name)' it shows me just the half.. I am using Putty to access my server.
Also, is it possible to edit a file from a unix system on a 'Gedit for Windows" text editor?
Thanks (7 Replies)
Discussion started by: DallasT
7 Replies
6. Shell Programming and Scripting
Hi All,
I have a file, let's call it "info.tmp" that contains data like this ..
ABC123456
PCX333445
BCD789833
I need to read "info.tmp" and for each line add strings in a way that the final output is
put /logs/ua/dummy.trigger 'AAA00001.FTP.XXX.BLA03A01.xxxxxx(+1)'
where XXX... (5 Replies)
Discussion started by: Andy_ARG
5 Replies
7. Programming
Input_file
#tmp_2
werweraewghe
@tmp_2
123sdfs57a
#tmp_1
aewrgheheghe
@tmp_1
457awrerfa87
#tmp_4
trtyrghe
@tmp_4
8898rtyr2
reference_file
#tmp_4
#tmp_1 (14 Replies)
Discussion started by: cpp_beginner
14 Replies
8. Shell Programming and Scripting
I have a process which writes lots of output to the screen and am capturing it to a file.
But the issue is that there are few lines which repeat every second which is causing the file size to be enormous. I am trying to filter out and then run the command but its not working.
Can you confirm... (7 Replies)
Discussion started by: rajkumarme_1
7 Replies
9. Shell Programming and Scripting
I've got a file that looks like this (spaces before first entries intentional):
12345650-000005000GL140227 ANNUAL HELC FEE EN
22345650-000005000GL140227 ANNUAL HELC FEE EN
32345650-000005000GL140227 ANNUAL HELC FEE EN
I want to read through the file line by line,... (6 Replies)
Discussion started by: Scottie1954
6 Replies
10. UNIX for Dummies Questions & Answers
sxsaaas (3 Replies)
Discussion started by: VikrantD
3 Replies
LEARN ABOUT DEBIAN
filtergen
FILTERGEN(8) System Manager's Manual FILTERGEN(8)
NAME
filtergen - packet filter compiler
SYNOPSIS
filtergen [ -h | --help ] [ -V | --version ] [ -c | --compile ] [ -t target | --target=target ] [ -o outfile | --output=outfile ] infile
filtergen [ -h | --help ] [ -V | --version ] [ -c | --compile ] [ -t target | --target=target ] [ -o outfile | --output=outfile ] [ -F pol-
icy | --flush=policy ]
DESCRIPTION
filtergen compiles a high-level filtering description language into a variety of target formats.
USAGE
filtergen reads the ruleset from the infile specified on the command line (or standard input if infile is "-") and outputs to standard out-
put (or outfile) via an optionally specified backend.
Both short and GNU-style long option options are accepted:
-c, --compile
Only try to "compile" the input, and do not generate any output. This may be useful to check that an input file has no syntax
errors in it before one attempts to use the result on a live server.
-t target-filter, --target=target-filter
If specified, target-filter will be used to select an output filter type, otherwise the default of iptables will be used. Supported
backends are iptables, ipchains, ipfilter and cisco (for Cisco IOS access-lists).
-F policy, --flush=policy
Flush mode. Generate a set of rules for clearing all rules from the packet filter. Useful for firewall scripts that need to `shut-
down' the firewall. You can supply a policy argument in place of the usual filename, to specify whether the flushed filter should
default to accept, reject, or drop. It defaults to accept, equivalent to having no filter loaded at all. It is not necessary to
specify an infile when using flush mode.
-o outfile, --output=outfile
Write output to outfile instead of standard output.
-h, --help
Show command help.
-V, --version
Show program version.
BUGS
Not all backends implement all features.
The packet filter is not optimised.
SEE ALSO
fgadm(8), filter_syntax(5), filter_backends(7)
AUTHOR
filtergen was originally written by Matthew Kirkwood. Jamie Wilkinson <jaq@spacepants.org> then rewrote a lot of the internals, added some
features, and took on maintenance of the project.
January 7, 2004 FILTERGEN(8)