Sponsored Content
Top Forums Shell Programming and Scripting Replacing strings in a log file and saves as a new csv Post 302269052 by tententen on Tuesday 16th of December 2008 07:03:44 PM
Old 12-16-2008
Computer Replacing strings in a log file and saves as a new csv

Hello Im new here.I need to replace strings and change it into csv format, or at least saves the file as csv if that would work Smilie. Heres an example of my scenario

1) I have a log file, named abc.log, and its like a txt based file anyway, and the content looks like this

my-test1/lab_mt01.tst,lab_mt01.tst,ge-3/3/1.140
my-test2/lab_mt02.tst,lab_mt02.tst,lo0.140

2) I need a method to read this file, line by line, ignoring the first statement until it reaches the first slash, then from there, replaces the commas with semicolons, so it'll look like this

from
my-test1/lab_mt01.tst,lab_mt01.tst,ge-3/3/1.140
my-test2/lab_mt02.tst,lab_mt02.tst,lo0.140

to
lab_mt01.tst;lab_mt01.tst;ge-3/3/1.140
lab_mt02.tst;lab_mt02.tst;lo0.140

and saves it in csv format.

That would help for now. I really appreaciate your help. Im very new in shell/perl so I would hope an answer which suits the really2 'dummies' :P.

Thank you!.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

replacing commas with tilde in csv file.

hello all, i have a comma delimited file. i want to replace the commas in the file with the tilde symbol using sed. how can i do this? thanks. (4 Replies)
Discussion started by: femig
4 Replies

2. Shell Programming and Scripting

replacing strings with text from other file

Hi, Im trying to update some properties files with text from another file: file1 user=xyz file2 user= after script file2 user=xyz Im using this reading the $QUARTZURL,ETC... from quartz.properties: echo... (1 Reply)
Discussion started by: mc1392
1 Replies

3. UNIX for Dummies Questions & Answers

Replacing characters in csv file

Hello all, This is my first post here, so please excuse me if this question is too obvious or has been asked before. I am new to Unix and although I tried to search your forum for the answer to my question, I could not find an answer that would help me. I have a 500MB csv file with numeric values... (1 Reply)
Discussion started by: finwhiz
1 Replies

4. Shell Programming and Scripting

Replacing text in a .csv file using Perl

I have played with this for some time but i dont seem like i am getting it right. I am trying to change the delimiters on a file so i can import it into a database. this file has rows of data separated by enter Right now the delimiters are represented by tabs and " ". e.g. "dlfkldfs... (9 Replies)
Discussion started by: salemh
9 Replies

5. Shell Programming and Scripting

Replacing strings in csv file.

Hi, I have a problem.. 1) I have a file that contains the lines as below : VRF-TM_DummyLab/mse02.lab,mse02.lab,ge-2/0/7.222 VRF-EMS_HUAWEI_MSAN_208/mse01.lab,mse01.lab,xe-1/0/0.208 2) I need a method to read this file, line by line from :... (5 Replies)
Discussion started by: msafwan82
5 Replies

6. Shell Programming and Scripting

Replacing Strings in a File

I have a input file which looks like this: Value1="" Value2="" Value3="" ListOfValues=" $Value1 $Value2 $Value3" I have another program which computes the values ($val1, $val2, $val3). So if $val1 is 'A', $val2 is 'B' and $val3 is 'C', I should edit the input file so it will look like:... (0 Replies)
Discussion started by: laiko
0 Replies

7. Shell Programming and Scripting

Replacing Strings in a File

I have a input file which looks like this: Value1="" Value2="" Value3="" ListOfValues=" $Value1 $Value2 $Value3" I have another program which computes the values ($val1, $val2, $val3). So if $val1 is 'A', $val2 is 'B' and $val3 is 'C', I should edit the input file so it will look like:... (6 Replies)
Discussion started by: laiko
6 Replies

8. UNIX for Advanced & Expert Users

Replacing the comma in .csv file in unix

Hi All, Could some one help me on one of my requirement below: I have a sequential file with 4fields in it and it is a comma (,) seperated file. Delimeter is 'comma'. But in of the file column for ex: 3rd column it is 'Description' (column name) I am getting the values with commas.... (6 Replies)
Discussion started by: eskay_s
6 Replies

9. Shell Programming and Scripting

Finding/replacing strings in some files based on a file

Hi, We have a file (e.g. a .csv file, but could be any other format), with 2 columns: the old value and the new value. We need to modify all the files within the current directory (including subdirectories), so find and replace the contents found in the first column within the file, with the... (9 Replies)
Discussion started by: Talkabout
9 Replies

10. Shell Programming and Scripting

Match list of strings in File A and compare with File B, C and write to a output file in CSV format

Hi Friends, I'm a great fan of this forum... it has helped me tone my skills in shell scripting. I have a challenge here, which I'm sure you guys would help me in achieving... File A has a list of job ids and I need to compare this with the File B (*.log) and File C (extend *.log) and copy... (6 Replies)
Discussion started by: asnandhakumar
6 Replies
MODPODS(1p)						User Contributed Perl Documentation					       MODPODS(1p)

NAME
modpods - print out paths for the standard modules DESCRIPTION
This program outputs the paths to all installed modules on your systems. This includes both the standard modules (which the stdpods command produces) and the site-specific ones (which the sitepods command produces). This is just a front-end for calling pminst -l, supplied to make it more obvious what it does. EXAMPLE
This finds all the modules whose documentation mentions destructors, and cats it out at you. $ podgrep -i destructor `modpods` =head1 /usr/local/devperl/lib/5.00554/i686-linux/DB_File.pm chunk 371 Having read L<perltie> you will probably have already guessed that the error is caused by the extra copy of the tied object stored in C<$X>. If you haven't, then the problem boils down to the fact that the B<DB_File> destructor, DESTROY, will not be called until I<all> references to the tied object are destroyed. Both the tied variable, C<%x>, and C<$X> above hold a reference to the object. The call to untie() will destroy the first, but C<$X> still holds a valid reference, so the destructor will not get called and the database file F<tst.fil> will remain open. The fact that Berkeley DB then reports the attempt to open a database that is alreday open via the catch-all "Invalid argument" doesn't help. =head1 /usr/local/devperl/lib/5.00554/Tie/Array.pm chunk 40 Normal object destructor method. SEE ALSO
podgrep(1), modpods(1), pods(1), sitepods(1), podpath(1), and stdpod(1). AUTHORS and COPYRIGHTS Copyright (C) 1999 Tom Christiansen. Copyright (C) 2006-2008 Mark Leighton Fisher. This is free software; you can redistribute it and/or modify it under the terms of either: (a) the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version, or (b) the Perl "Artistic License". (This is the Perl 5 licensing scheme.) Please note this is a change from the original pmtools-1.00 (still available on CPAN), as pmtools-1.00 were licensed only under the Perl "Artistic License". perl v5.10.1 2010-02-22 MODPODS(1p)
All times are GMT -4. The time now is 01:15 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy