Sponsored Content
Top Forums Shell Programming and Scripting awk, perl Script for processing a single line text file Post 302306388 by hmsadiq on Sunday 12th of April 2009 03:36:54 PM
Old 04-12-2009
awk, perl Script for processing a single line text file

I need a script to process a huge single line text file:

The sample of the text is:

"forward_inline_item": "Inline", "options_region_Australia": "Australia", "server_event_err_msg": "There was an error attempting to save", "Token": "Yes", "family": "Family","pwd_login_tab": "Enter Your Password:"

Expecting the following output:

forward_inline_item,Inline
options_region_Australia,Australia
server_event_err_msg,There was an error attempting to save
Token,Yes
family,Family
pwd_login_tab,Enter Your Password:
----------------------

Thanks
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script to add a single line to middle of text file.

I've got a configuration file that is filled with xml text statements for example: <...../> <...../> <...../> <data id="java-options" value="-server -Djava.security.policy..../> <...../> <...../> <...../> I want to write a korn shell script that will go to this specific line and add a... (2 Replies)
Discussion started by: progkcp
2 Replies

2. Shell Programming and Scripting

Need help to modify perl script: Text file with line and more than 1 space

Dear Friends, I am beginner in Perl and trying to find the problem in a script. Kindly help me to modify the script. My script is not giving the output for the last field and followed text (LA: Language English). Input file & script as follows: Input file: Thu Mar 19 2:34:14 EDT 2009 STC... (3 Replies)
Discussion started by: srsahu75
3 Replies

3. Shell Programming and Scripting

reading a file inside awk and processing line by line

Hi Sorry to multipost. I am opening the new thread because the earlier threads head was misleading to my current doubt. and i am stuck. list=`cat /u/Test/programs`; psg "ServTest" | awk -v listawk=$list '{ cmd_name=($5 ~ /^/)? $9:$8 for(pgmname in listawk) ... (6 Replies)
Discussion started by: Anteus
6 Replies

4. UNIX for Dummies Questions & Answers

single output of awk script processing multiple files

Helllo UNIX Forum :) Since I am posting on this board, yes, I am new to UNIX! I read a copy of "UNIX made easy" from 1990, which felt like a making a "computer-science time jump" backwards ;) So, basically I have some sort of understanding what the basic concept is. Problem Description:... (6 Replies)
Discussion started by: Kasimir
6 Replies

5. Shell Programming and Scripting

Perl or Awk script to copy a part of text file.

Hi Gurus, I'm a total newbie to Perl and Awk scripting. Let me explain the scenario, there is a DB2 table with 5 columns and one of the column is a CLOB datatype containing XML. We need all the 4 columns but only a portion of string from the XML column. We decided to export DB2 table to a .del... (26 Replies)
Discussion started by: asandy1234
26 Replies

6. UNIX for Advanced & Expert Users

perl text file processing using hash

Hi Experts, I have this requirement to process large files (200MB+).Format of files is like: recordstart val1 1 val2 2 val3 4 recordstart val1 5 val2 6 val3 1 val4 1 recordstart val1 ... (4 Replies)
Discussion started by: mtomar
4 Replies

7. Shell Programming and Scripting

editing single line in html file in perl script

Hi Folks, It is regarding the perl scripting. I have an html file(many files) which contains the below line in the body tag. <body> <P><STRONG><FONT face="comic sans ms,cursive,sans-serif"><EM>Hello</EM></FONT></STRONG></P> </body> Now I want to read that html file through perl... (3 Replies)
Discussion started by: giridhar276
3 Replies

8. Shell Programming and Scripting

Combine multiple unique lines from event log text file into one line, use PERL or AWK?

I can't decide if I should use AWK or PERL after pouring over these forums for hours today I decided I'd post something and see if I couldn't get some advice. I've got a text file full of hundreds of events in this format: Record Number : 1 Records in Seq : ... (3 Replies)
Discussion started by: Mayday22
3 Replies

9. Programming

awk processing / Shell Script Processing to remove columns text file

Hello, I extracted a list of files in a directory with the command ls . However this is not my computer, so the ls functionality has been revamped so that it gives the filesizes in front like this : This is the output of ls command : I stored the output in a file filelist 1.1M... (5 Replies)
Discussion started by: ajayram
5 Replies

10. Shell Programming and Scripting

How to add line breaks to perl command with large text in single quotes?

Below code extracts multiple field values from XML into array and prints all in one line. perl -nle '@r=/(?: jndiName| authDataAlias| value| minConnections| maxConnections| connectionTimeout| name)="(+)/g and print join ",",$ENV{tIPnSCOPE},$ENV{pr ovider},$ENV{impClassName},@r' server.xml ... (4 Replies)
Discussion started by: kchinnam
4 Replies
Test::Inline::Script(3pm)				User Contributed Perl Documentation				 Test::Inline::Script(3pm)

NAME
Test::Inline::Script - Generate the test file for a single source file DESCRIPTION
This class is where the heavy lifting happens to actually generating a test file takes place. Given a source filename, this modules will load it, parse out the relavent bits, put them into order based on the tags, and then merge them into a test file. METHODS
new my $File = Test::Inline::Script->new( $class, @sections, $check_count ); The "new" constructor takes a class name, set of Section objects and an optional "check_count" flag. Returns a Test::Inline::Script object on success. Returns "undef" on error. class Returns the class that the test file will test filename my $filename = $File->filename; The "filename" method returns the name of the output file that the tests should be written to. For example, the class "Foo::Bar" would have the filename value "foo_bar.t". config my $config = $File->config; The "config" method returns the config object for the file, assuming that it has one. If more than one are found, the first will be used, and any additional config sections discarded. Returns a Test::Inline::Config object on success, or false if the file does not contain a config section. setup my @setup = $File->setup; The "setup" method returns the setup sections from the file, in the same order as in the file. Returns a list of setup Test::Inline::Section objects, the null array "()" if the file does not contain any setup objects. sections my @sections = $File->sections; The "sections" method returns all normal sections from the file, in the same order as in the file. This may not be the order they will be written to the test file, for that you should see the "sorted" method. Returns a list of Test::Inline::Section objects, or the null array "()" if the file does not contain any non-setup sections. sorted The "sorted" method returns all normal sections from the file, in an order that satisfies any dependencies in the sections. Returns a reference to an array of Test::Inline::Section objects, 0 if the file does not contain any non-setup sections, or "undef" on error. tests If the number of tests for all of the sections within the file are known, then the number of tests for the entire file can also be determined. The "tests" method determines if the number of tests can be known, and if so, calculates and returns the number of tests. Returns false if the number of tests is not known. merged_content The "merged_content" method generates and returns the merged contents of all the sections in the file, including the setup sections at the beginning. The method does not return the entire file, merely the part contained in the sections. For the full file contents, see the "file_content" method. Returns a string containing the merged section content on success, false if there is no content, despite the existance of sections ( which would have been empty ), or "undef" on error. SUPPORT
See the main SUPPORT section. AUTHOR
Adam Kennedy <adamk@cpan.org>, <http://ali.as/> COPYRIGHT
Copyright 2004 - 2010 Adam Kennedy. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of the license can be found in the LICENSE file included with this module. perl v5.12.4 2010-11-22 Test::Inline::Script(3pm)
All times are GMT -4. The time now is 09:31 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy