Sponsored Content
Operating Systems Linux Red Hat Parsing a linux file and formatting it. Post 302491936 by DGPickett on Friday 28th of January 2011 04:48:28 PM
Old 01-28-2011
The ^C's have to be real cntrl-C characters,
a line with no text was not showing in output, so it is virtually empty, and

the big substitute says pick up:
  1. starting at the beginning of the line ^
  2. string1 \( +> \1
  3. and string 2 \( +> \2
  4. string 2 runs from beginning of line to first | (not | = [^|], any number = *, then |)
  5. string 1 is longer, runs to but not including first cntrl-C (not ^C, any number)
  6. the first ^C
but lay back down in their place:
  1. string 1 \1
  2. a line feed \linefeed
  3. string 2 \2
If that is possible, then a line with N texts is now a line of 1 text followed by a line of N-1 texts.

Last edited by DGPickett; 01-28-2011 at 05:54 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Parsing of file for Report Generation (String parsing and splitting)

Hey guys, I have this file generated by me... i want to create some HTML output from it. The problem is that i am really confused about how do I go about reading the file. The file is in the following format: TID1 Name1 ATime=xx AResult=yyy AExpected=yyy BTime=xx BResult=yyy... (8 Replies)
Discussion started by: umar.shaikh
8 Replies

2. Solaris

Linux partitioned disk mounted on OSOL without formatting

Hello and Merry Christmas... Quick question after tireless search around the web. Description: I have a WD My book world edition II that met an untimely death. However the 2 SATA disks inside seem to be working just fine. Want to add either one of them to my Solaris Desktop. Since I... (5 Replies)
Discussion started by: michnmi
5 Replies

3. UNIX for Dummies Questions & Answers

Parsing linux commands through FTP

Hi Techies, I have made a shell script which stores the output of it in a text file. then i wanted to fetch that text file using windows scheduler in my windows xp desktop which i did successfully using the below mentioned ftp .bat file : @echo off @echo ftp_user>ftp_test.scr @echo... (0 Replies)
Discussion started by: gemnian.g
0 Replies

4. Shell Programming and Scripting

Formatting file data to another file (control character related)

I have to write a program to read data from files and then format into another file. However, I face a strange problem related to control character that I can't understand and solve. The source file is compose of many lines with such format: T_NAME|P_NAME|P_CODE|DOCUMENT_PATH|REG_DATE ... (3 Replies)
Discussion started by: hk6279
3 Replies

5. Shell Programming and Scripting

Help - Parsing data in XML in Linux

Hi, I have an XML file in Linux and it contains a long string of characters. The last part of the file is like ....... ....... ....... CAD</MarketDescription></InvestorTransaction></AdvisorAccount></DivisionAdvisor></Division>... (3 Replies)
Discussion started by: naveed
3 Replies

6. Shell Programming and Scripting

Formatting a file

Hi Experts I have a file which looks as follows acttest /report/fieldsinf/acttest/LIVE/acttest Chris New teatin1 /report/fieldsinf/eatin1/TEST/teatin1 Chris New eatin1 /report/fieldsinf/eatin1/LIVE/eatin1 Chris New tbectest ... (7 Replies)
Discussion started by: maverick_here
7 Replies

7. UNIX for Dummies Questions & Answers

Formatting data in a raw file by using another mapping file

Hi All, i have a requirement where i need to format the input RAW file ( which is CSV) by using another mapping file(also CSV file). basically i am getting feed file with dynamic headers by using mapping file (in that target field is mapped with source filed) i have to convert the raw file into... (6 Replies)
Discussion started by: ravi4informatic
6 Replies

8. Shell Programming and Scripting

Specific string parsing in Linux/UNIX

Hi, I have a string which can be completely unstructred. I am looking to parse out values within that String. Here is an example <Random Strings> String1=<some number a> String2=<some number b> String3=<some number c> Satish=<some number d> String4=<some number e> I only want to parse out... (1 Reply)
Discussion started by: satishrao
1 Replies

9. Shell Programming and Scripting

Table like formatting in Linux

Dear experts, I need bit help in formatting .. I have csv file file , i will read that file by passing one column value as input parameter and display header row and corresponding row for that parameter. I have shell script like this: #!/bin/bash #key_word_I_am_looking_for=$1 #awk... (16 Replies)
Discussion started by: onenessboy
16 Replies

10. Shell Programming and Scripting

Parsing syslog from Linux

Hello, I'm facing problem to extract fields from below syslog : logver=56 idseq=63256900099118326 itime=1563205190 devid=FG-5KDTB18800138 devname=LAL-C1-FGT-03 vd=USER date=2019-07-15 time=18:39:49 logid="0000000013" type="traffic" subtype="forward" level="notice" eventtime=1563205189... (17 Replies)
Discussion started by: arm
17 Replies
FusionInventory::Agent::Tools(3pm)			User Contributed Perl Documentation			FusionInventory::Agent::Tools(3pm)

NAME
FusionInventory::Agent::Tools - OS-independant generic functions DESCRIPTION
This module provides some OS-independant generic functions. FUNCTIONS
getFormatedLocalTime($time) Returns a formated date from given Unix timestamp. getFormatedGmTime($time) Returns a formated date from given Unix timestamp. getFormatedDate($year, $month, $day, $hour, $min, $sec) Returns a formated date from given date elements. getCanonicalManufacturer($manufacturer) Returns a normalized manufacturer value for given one. getCanonicalSpeed($speed) Returns a normalized speed value (in Mhz) for given one. getCanonicalSize($size) Returns a normalized size value (in Mb) for given one. getSanitizedString($string) Returns the input stripped from any control character, properly encoded in UTF-8. compareVersion($major, $minor, $min_major, $min_minor) Returns true if software with given major and minor version meet minimal version requirements. getDirectoryHandle(%params) Returns an open file handle on either a command output, or a file. logger a logger object directory the directory to use getFileHandle(%params) Returns an open file handle on either a command output, a file, or a string. logger a logger object command the command to use file the file to use, as an alternative to the command string the string to use, as an alternative to the command getFirstLine(%params) Returns the first line of given command output or given file content, with end of line removed. logger a logger object command the exact command to use file the file to use, as an alternative to the command getAllLines(%params) Returns all the lines of given command output or given file content, with end of line removed. logger a logger object command the exact command to use file the file to use, as an alternative to the command getFirstMatch(%params) Returns the result of applying given pattern on the first matching line of given command output or given file content. pattern a regexp logger a logger object command the exact command to use file the file to use, as an alternative to the command getLastLine(%params) Returns the last line of given command output or given file content. logger a logger object command the exact command to use file the file to use, as an alternative to the command getLinesCount(%params) Returns the number of lines of given command output or given file content. logger a logger object command the exact command to use file the file to use, as an alternative to the command canRun($binary) Returns true if given binary can be executed. canRead($file) Returns true if given file can be read. canLoad($module) Returns true if given perl module can be loaded (and actually loads it). hex2char($value) Returns the value converted to a character if it starts with hexadecimal prefix, the unconverted value otherwise. Eg. 0x41 -> A, 41 -> 41. hex2dec($value) Returns the value converted to a decimal if it starts with hexadecimal prefix, the unconverted value otherwise. Eg. 0x41 -> 65, 41 -> 41. dec2hex($value) Returns the value converted to an hexadecimal if it doesn't start with hexadecimal prefix, the unconverted value otherwise. Eg. 65 -> 0x41, 0x41 -> 0x41. any BLOCK LIST Returns a true value if any item in LIST meets the criterion given through BLOCK. all BLOCK LIST Returns a true value if all items in LIST meet the criterion given through BLOCK. none BLOCK LIST Returns a true value if no item in LIST meets the criterion given through BLOCK. uniq BLOCK LIST Returns a new list by stripping duplicate values in LIST. file2module($string) Converts a perl file name to a perl module name (Foo/Bar.pm -> Foo::Bar) module2file($string) Converts a perl module name to a perl file name ( Foo::Bar -> Foo/Bar.pm) runFunction(%params) Run a function whose name is computed at runtime and return its result. logger a logger object module the function namespace function the function name timeout timeout for function execution load enforce module loading first delay($second) Wait for $second. It uses sleep() or Win32::Sleep() depending on the Operating System. perl v5.14.2 2012-06-25 FusionInventory::Agent::Tools(3pm)
All times are GMT -4. The time now is 10:59 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy