Perl - need script for modify lines


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Perl - need script for modify lines
# 1  
Old 08-21-2010
Perl - need script for modify lines

Hello,

does somebody can make script for me, which replace:
Code:
ąćę
ąćę
ąćę

(input file)

to

Code:
ace;|;ąćę
ace;|;ąćę
ace;|;ąćę

(output file)
# 2  
Old 08-21-2010
sed:
Code:
 sed 's/\(.*\)/ace;|;\1/' inputfile

awk:
Code:
 awk '{print "ace;|;" $0}' inputfile

perl:
# 3  
Old 08-21-2010
Code:
sed 's/^/ace;|;/' urfile

awk '$0="ace;|;" $0' urfile

perl -p -e  's/^/ace;|;/' urfile

# 4  
Old 08-21-2010
Quote:
Originally Posted by rdcwayx
Code:
sed 's/^/ace;|;/' urfile

awk '$0="ace;|;" $0' urfile

perl -p -e  's/^/ace;|;/' urfile

Why does it get error?
Code:
 sed 's/^/ace;|;\1/' urfile

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl script to modify csv file

Hi Friends, I want to convert a csv file into a ordinary .txt file. I am able to convert but I want the output to look as shown below in the .txt file table findhost= { {"xyz","abc"}, {"rxz","mmz"}, {"vrr","nnz"}, } default={"NONE"} My current perl script #!/usr/bin/env perl... (12 Replies)
Discussion started by: dbashyam
12 Replies

2. UNIX for Dummies Questions & Answers

How to modify lines without certain patterns?

I have file like this: rs111 A T 0.9 0.8 ... rs112 AT T 0.8 0.2 ... rs113 G CT 0.9 0.1... I wish to replace all the NONE "A" or "T" or "G" or "C" values in column 3 and column 4 to " ", how can I do this? thanks! (8 Replies)
Discussion started by: luoruicd
8 Replies

3. Shell Programming and Scripting

about the modify lines

Hello, I am trying to convert lines from text file, I got lines in text files like that ALPHA.cab tomtom.cab vgame.cab converter.cabWhat i want to do is I want to conver these lines like that, cabwiz.exe ALPHA.cab extract "C:\1extract\ALPHA" cabwiz.exe tomtom.cab extract ... (5 Replies)
Discussion started by: davidkhan
5 Replies

4. Shell Programming and Scripting

Modify Perl Script To Send Attachments

Hello, I'm a newbie to the world of programming and so i decided to take up perl. I'm trying to learn how to modify the script below in order to have it sent with attachments. Any suggestions? #!/usr/bin/perl -w use strict; use warnings; my $from = 'xxx@domain.com'; my $to =... (0 Replies)
Discussion started by: xmaverick
0 Replies

5. Shell Programming and Scripting

Modify a perl script to find and count

Hello all !I have two sets of folders that have IP address from two sources.The below perl script I was working with needs some corrections.I am looking for the perl script to identify and count what IP address are found to be duplicated between both files.The format from both files are the same... (4 Replies)
Discussion started by: richsark
4 Replies

6. 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

7. Shell Programming and Scripting

[Help] PERL Script - grep multiple lines

Hi Gurus, I need some help with the "grep" command or whatever command that you think suitable for me. I'm about to write a perl script to extract a report from the system and submit it to the end users. The input for the script will consist of 3 element. 1) Generation ID 2) Month 3) Year... (6 Replies)
Discussion started by: miskin
6 Replies

8. UNIX for Dummies Questions & Answers

Perl/shell script count the lines

Hi Guys, I want to write a perl/shell script do parse the following file input file content NPA-NXX SC 2084549 45 2084552 45 2084563 2007 2084572 45 2084580 45 3278411 45 3278430 45 3278493 530 3278507 530... (3 Replies)
Discussion started by: pistachio
3 Replies

9. UNIX for Dummies Questions & Answers

How to use sed modify specific lines

Could anybody tell me how I can use sed to modify lines following specific lines? the file is as following: "TEST/SI1573.lab" 3670 8920 h# 8920 9530 hh 9530 10694 ih . "TEST/DR1/FAKS0/SI2203.lab" 9730 9580 h# 9580 9840 dh 9840 10652 ix 10652 11997 r ........ I want to modify the... (5 Replies)
Discussion started by: Jenny.palmy
5 Replies

10. Shell Programming and Scripting

Modify Perl script to work with txt - Permissions script

Hi I have this code, and i want work with a ls -shalR output in .txt What i need read to do this?? Where start? #!/usr/bin/perl # Allrights- A perl tool for making backups of file permissions # Copyright (C) 2005 Norbert Klein <norbert@acodedb.com> # This program is free... (1 Reply)
Discussion started by: joangopan
1 Replies
Login or Register to Ask a Question