Sponsored Content
Top Forums Shell Programming and Scripting How to substract selective values in multi row, multi column file (using awk or sed?) Post 302715739 by nricardo on Monday 15th of October 2012 10:13:04 AM
Old 10-15-2012
Thanks a lot vgersh99, your code did exactly what I was looking for!! And BTW, thanks so much for the quick replies, you guys are awesome! ALso tried scottaazz code and it works as good, but was easier for me to modify into multiple (>2) lines. Thanks again!

Last edited by nricardo; 10-15-2012 at 01:29 PM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

multi-file multi-edit

Good day! I am trying to learn how to use the "sed" editor, to perform multiple edits on multiple files in multiple directories. I have one script that tries to call up each file and process it according to the edits listed in a second script. I am using a small input text to test these, at... (12 Replies)
Discussion started by: kielitaide
12 Replies

2. Shell Programming and Scripting

Sorting multi-column values from a specific file

Hi, all. I need a shell script which gathers data from a remote XML file and then displays it according to my needs.. I need this for my job due to the fact that I need to keep track price changes of euro, usd, gold, etc. The XML file I am talking about is located at this page: cnnturk dot... (4 Replies)
Discussion started by: canimsin
4 Replies

3. UNIX for Dummies Questions & Answers

sed insert content of file.txt to multi files

Ive this sed & find command find /home/www/ -name footer.php -exec sed -i 's/<\/body>/file.txt\n<\/body>/' what I need to place content of file.txt before </body> in all footer.php files file.txt content is google analytic script which is like 7 lines any help to adjust my command to... (2 Replies)
Discussion started by: xmoe
2 Replies

4. Shell Programming and Scripting

Multi-line filtering based on multi-line pattern in a file

I have a file with data records separated by multiple equals signs, as below. ========== RECORD 1 ========== RECORD 2 DATA LINE ========== RECORD 3 ========== RECORD 4 DATA LINE ========== RECORD 5 DATA LINE ========== I need to filter out all data from this file where the... (2 Replies)
Discussion started by: Finja
2 Replies

5. Shell Programming and Scripting

Gawk - to extract values from multi lined file

Hi, I am new to awk and trying to extract some specific fields from the a large file. Can you please help me to write gawk code displaying the out put in the below format: Desired Output: name fallback_ip member member www-trymps.extlb.plstry.com-pool-1 180.254.112.50 ... (4 Replies)
Discussion started by: pratheeshp
4 Replies

6. Shell Programming and Scripting

Gawk - to extract values from multi lined file -I

Hi, Request your help in getting help with the below text formatting using awk. I am still learning awk and your help here is appreciated. Thanks in advance. Desireoutput ---------------- Virtual Pool Destination Profile Profile Profile Profile 1. virtual-1 pool-1 212.254.110.174:https... (2 Replies)
Discussion started by: pratheeshp
2 Replies

7. Shell Programming and Scripting

Selective Replace awk column values

Hi, I have the following data: 2860377|"DATA1"|"DATA2"|"65343"|"DATA2"|"DATA4"|"11"|"DATA5"|"DATA6"|"65343"|"DATA7"|"0"|"8"|"1"|"NEGATIVE" 32340377|"DATA1"|"DATA2"|"65343"|"DATA2"|"DATA4"|"11"|"DATA5"|"DATA6"|"65343"|"DATA7"|"0"|"8"|"1"|"NEG-DID"... (3 Replies)
Discussion started by: sdohn
3 Replies

8. Shell Programming and Scripting

Replacing lines matching a multi-line pattern (sed/perl/awk)

Dear Unix Forums, I am hoping you can help me with a pattern matching problem. What am I trying to do? I want to replace multiple lines of a text file (that match a multi-line pattern) with a single line of text. These patterns can span several lines and do not always have the same number of... (10 Replies)
Discussion started by: thefang
10 Replies

9. Programming

Multi head/multi window hello world

I am trying to write a large X app. I have successfully modified my xorg.conf to setup 4 monitors on an NVIDIA Quatro5200. I am trying to modify a simple hello world application to open a window on three of the four monitors. depending on the changes to loop the window creation section and event... (2 Replies)
Discussion started by: advorak
2 Replies

10. Programming

DB2 Query -Convert multi values from column to rows

Hi Team I am using DB2 artisan tool and struck to handle multi values present in columns that are comma(,) separated. I want to convert those column values in separate rows . For example : Column 1 Column2 Jan,Feb Hold,Sell,Buy Expected Result Column1 ... (3 Replies)
Discussion started by: Perlbaby
3 Replies
Data::Dump(3)						User Contributed Perl Documentation					     Data::Dump(3)

NAME
Data::Dump - Pretty printing of data structures SYNOPSIS
use Data::Dump qw(dump); $str = dump(@list); @copy_of_list = eval $str; # or use it for easy debug printout use Data::Dump; dd localtime; DESCRIPTION
This module provide a few functions that traverse their argument and produces a string as its result. The string contains Perl code that, when "eval"ed, produces a deep copy of the original arguments. The main feature of the module is that it strives to produce output that is easy to read. Example: @a = (1, [2, 3], {4 => 5}); dump(@a); Produces: "(1, [2, 3], { 4 => 5 })" If you dump just a little data, it is output on a single line. If you dump data that is more complex or there is a lot of it, line breaks are automatically added to keep it easy to read. The following functions are provided (only the dd* functions are exported by default): dump( ... ) pp( ... ) Returns a string containing a Perl expression. If you pass this string to Perl's built-in eval() function it should return a copy of the arguments you passed to dump(). If you call the function with multiple arguments then the output will be wrapped in parenthesis "( ..., ... )". If you call the function with a single argument the output will not have the wrapping. If you call the function with a single scalar (non-reference) argument it will just return the scalar quoted if needed, but never break it into multiple lines. If you pass multiple arguments or references to arrays of hashes then the return value might contain line breaks to format it for easier reading. The returned string will never be " " terminated, even if contains multiple lines. This allows code like this to place the semicolon in the expected place: print '$obj = ', dump($obj), "; "; If dump() is called in void context, then the dump is printed on STDERR and then " " terminated. You might find this useful for quick debug printouts, but the dd*() functions might be better alternatives for this. There is no difference between dump() and pp(), except that dump() shares its name with a not-so-useful perl builtin. Because of this some might want to avoid using that name. quote( $string ) Returns a quoted version of the provided string. It differs from "dump($string)" in that it will quote even numbers and not try to come up with clever expressions that might shorten the output. If a non-scalar argument is provided then it's just stringified instead of traversed. dd( ... ) ddx( ... ) These functions will call dump() on their argument and print the result to STDOUT (actually, it's the currently selected output handle, but STDOUT is the default for that). The difference between them is only that ddx() will prefix the lines it prints with "# " and mark the first line with the file and line number where it was called. This is meant to be useful for debug printouts of state within programs. dumpf( ..., &filter ) Short hand for calling the dump_filtered() function of Data::Dump::Filtered. This works like dump(), but the last argument should be a filter callback function. As objects are visited the filter callback is invoked and it can modify how the objects are dumped. CONFIGURATION
There are a few global variables that can be set to modify the output generated by the dump functions. It's wise to localize the setting of these. $Data::Dump::INDENT This holds the string that's used for indenting multiline data structures. It's default value is " " (two spaces). Set it to "" to suppress indentation. Setting it to "| " makes for nice visuals even if the dump output then fails to be valid Perl. $Data::Dump::TRY_BASE64 How long must a binary string be before we try to use the base64 encoding for the dump output. The default is 50. Set it to 0 to disable base64 dumps. LIMITATIONS
Code references will be dumped as "sub { ... }". Thus, "eval"ing them will not reproduce the original routine. The "..."-operator used will also require perl-5.12 or better to be evaled. If you forget to explicitly import the "dump" function, your code will core dump. That's because you just called the builtin "dump" function by accident, which intentionally dumps core. Because of this you can also import the same function as "pp", mnemonic for "pretty- print". HISTORY
The "Data::Dump" module grew out of frustration with Sarathy's in-most-cases-excellent "Data::Dumper". Basic ideas and some code are shared with Sarathy's module. The "Data::Dump" module provides a much simpler interface than "Data::Dumper". No OO interface is available and there are fewer configuration options to worry about. The other benefit is that the dump produced does not try to set any variables. It only returns what is needed to produce a copy of the arguments. This means that "dump("foo")" simply returns '"foo"', and "dump(1..3)" simply returns '(1, 2, 3)'. SEE ALSO
Data::Dump::Filtered, Data::Dump::Trace, Data::Dumper, JSON, Storable AUTHORS
The "Data::Dump" module is written by Gisle Aas <gisle@aas.no>, based on "Data::Dumper" by Gurusamy Sarathy <gsar@umich.edu>. Copyright 1998-2010 Gisle Aas. Copyright 1996-1998 Gurusamy Sarathy. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.18.2 2013-05-10 Data::Dump(3)
All times are GMT -4. The time now is 10:32 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy