Topics | Search Log Out | Register | Edit Profile
Hide Clipart | Banned/Unbanned User Log | Moderator Login History | Thread Delete/Move Log | Last 30 mins | 1 | 2
Any unix/perl experts??

Chalanachithram.com DB » Archives » Archive through April 07, 2010 » Any unix/perl experts?? « Previous Next »
Author Message
 

Sachin
Hero
Username: Sachin

Post Number: 14607
Registered: 04-2008
Posted From: 24.187.205.230

Rating: N/A
Votes: 0 (Vote!)

Posted on Wednesday, April 07, 2010 - 05:14 pm:       


Trueleader:




thanks annnai
 

Trueleader
Comedian
Username: Trueleader

Post Number: 1976
Registered: 09-2009
Posted From: 216.241.170.12

Rating: N/A
Votes: 0 (Vote!)

Posted on Wednesday, April 07, 2010 - 05:13 pm:       

Perl Solution

my $Infile ='/f1.txt'; #source file
my $Outfile= '/f2.txt'; #destination file
open(INFILE, $Infile) or die("Could not open file");

my @buffer = (<infile>);
close INFILE;
open (OUTFILE, ">$Outfile") or die("Could not write to file");

foreach $list(@buffer) {
my @values = split("'", $list); #use the seperator required
foreach $line(@values) {
print OUTFILE $line."\n";
}
}
close OUTFILE;
 

Sachin
Hero
Username: Sachin

Post Number: 14602
Registered: 04-2008
Posted From: 24.187.205.230

Rating: N/A
Votes: 0 (Vote!)

Posted on Wednesday, April 07, 2010 - 04:52 pm:       


Goonda:




thanks bhayya
 

Goonda
Hero
Username: Goonda

Post Number: 12709
Registered: 02-2007
Posted From: 75.66.169.61

Rating: N/A
Votes: 0 (Vote!)

Posted on Wednesday, April 07, 2010 - 04:46 pm:       


Sachin:


sachin, here is what you have to do

put these lines into any file, example purpose put in changes.sh

#!/bin/bash
sed "s#$1#\n#g" $2

save the file

change the permision of the changes.sh to executable by executing this command
chmod +x changes.sh

now execute the script at command prompt with following command
./changes.sh \' <your-delimmiter-file-name>

in the shell script $1 and $2 are parameters, $1-> is your delimitter, $2-> your file name.

if you want the output into a different file use the following command

./changes.sh \' <your-delimmiter-file-name> >>output.txt

Hope this helps
 

Maverick
Hero
Username: Maverick

Post Number: 15084
Registered: 01-2008
Posted From: 192.146.101.24

Rating: N/A
Votes: 0 (Vote!)

Posted on Wednesday, April 07, 2010 - 04:13 pm:       


Linkmaster:

sed -i 's/\'/\n/' filename




sed -i 's/\'/\n/' anukunta
 

Sachin
Hero
Username: Sachin

Post Number: 14597
Registered: 04-2008
Posted From: 24.187.205.230

Rating: N/A
Votes: 0 (Vote!)

Posted on Wednesday, April 07, 2010 - 03:56 pm:       


Linkmaster:

cat file.txt | sed -i 's/\'/\n/' filename >> result.txt




thanks annnai....

ana full script kaavaaali.....unix lo #bin laaga emana untada perl lo.....also nenu delimiter pass cheyalanuko parameter laagaaa script ela undali
 

Linkmaster
Hero
Username: Linkmaster

Post Number: 13514
Registered: 02-2008
Posted From: 173.15.107.157

Rating: N/A
Votes: 0 (Vote!)

Posted on Wednesday, April 07, 2010 - 03:53 pm:       

cat file.txt | sed -i 's/\'/\n/' >> result.txt
 

Linkmaster
Hero
Username: Linkmaster

Post Number: 13513
Registered: 02-2008
Posted From: 173.15.107.157

Rating: N/A
Votes: 0 (Vote!)

Posted on Wednesday, April 07, 2010 - 03:53 pm:       


Sachin:


suppose file name is file.txt ....naaaku full script ivvavaaa ela untado





Thammmudu,


cat file.txt | sed -i 's/\'/\n/' filename >> result.txt




it should work
 

Sachin
Hero
Username: Sachin

Post Number: 14596
Registered: 04-2008
Posted From: 24.187.205.230

Rating: N/A
Votes: 0 (Vote!)

Posted on Wednesday, April 07, 2010 - 03:50 pm:       


Maverick:

one time scenario na or regular ga script process chesi cheyyala




scripting cheyali annai....i have zero knowledge on scripting.....basicga anenu ila linesgaa devide chese plsql tho tables loki load cheyali......

suppose file name is file.txt ....naaaku full script ivvavaaa ela untado
 

Maverick
Hero
Username: Maverick

Post Number: 15083
Registered: 01-2008
Posted From: 192.146.101.24

Rating: N/A
Votes: 0 (Vote!)

Posted on Wednesday, April 07, 2010 - 03:45 pm:       


Maverick:

sed -i 's/\'/\n/' filename




sed -i 's/\'/\n/' filename
 

Maverick
Hero
Username: Maverick

Post Number: 15082
Registered: 01-2008
Posted From: 192.146.101.24

Rating: N/A
Votes: 0 (Vote!)

Posted on Wednesday, April 07, 2010 - 03:43 pm:       


Sachin:




one time scenario na or regular ga script process chesi cheyyala

one time aite textpad d/l chesuko. open the file. search replace option use cheyy( check the reg expression box)..search for ' and replace with \n..save the file and load.

script aite try chesi choodu

sed -i 's/\'/\n/' filename
 

Sachin
Hero
Username: Sachin

Post Number: 14594
Registered: 04-2008
Posted From: 24.187.205.230

Rating: N/A
Votes: 0 (Vote!)

Posted on Wednesday, April 07, 2010 - 03:37 pm:       


Maverick:




annai naaku data ilaa vasthadi

this is the firstline'this is the second line'this is the third line

so naa aoutput

this is the firstline
this is the second line
this is the third line

alaaaa raavaaaali.....aa data ni oracle tables loki load cheyali.....new line delimiter ayithe i can use sql loader/external tables to load data..but ikkada delimited' undi...adi prob
 

Humpty_dumpty
Side Hero
Username: Humpty_dumpty

Post Number: 6524
Registered: 02-2009
Posted From: 38.117.247.14

Rating: N/A
Votes: 0 (Vote!)

Posted on Wednesday, April 07, 2010 - 03:26 pm:       

//but nenu file lo data split chesi same file lo unchalai.//

i dont know if unix/perl can do what u asked for but if you have already have write permission, jus rename the original file and write a a file with changed data and old file name...simpulu!
 

Maverick
Hero
Username: Maverick

Post Number: 15081
Registered: 01-2008
Posted From: 192.146.101.24

Rating: N/A
Votes: 0 (Vote!)

Posted on Wednesday, April 07, 2010 - 03:24 pm:       

is it something like'break from here

to

is it something like
break from here
 

Sachin
Hero
Username: Sachin

Post Number: 14592
Registered: 04-2008
Posted From: 24.187.205.230

Rating: N/A
Votes: 0 (Vote!)

Posted on Wednesday, April 07, 2010 - 03:19 pm:       


Kadapanagfan:

Mav manchi expert anukunta




edo oka function kanipinchindi online lo..but nenu file lo data split chesi same file lo unchalai....

http://perlmeme.org/howtos/perlfunc/split_function.html
 

Kadapanagfan
Megastar
Username: Kadapanagfan

Post Number: 23778
Registered: 12-2006
Posted From: 192.76.82.90

Rating: N/A
Votes: 0 (Vote!)

Posted on Wednesday, April 07, 2010 - 03:18 pm:       


Sachin:

Any unix/perl experts??




Mav manchi expert anukunta
 

Sachin
Hero
Username: Sachin

Post Number: 14591
Registered: 04-2008
Posted From: 24.187.205.230

Rating: N/A
Votes: 0 (Vote!)

Posted on Wednesday, April 07, 2010 - 03:15 pm:       

naa daggara oka text file undi......andulo data ni oka seperator (say ' ) use chesi linesgaa devide cheyaali.....ela chestharu

Add Your Message Here
Post:
Bold text Italics Underline Create a hyperlink Insert a clipart image HASH(0x1df5ef8){Movie Clipart}
Show / hide regular icons selection options

Click on following links to open cliparts by Alphabetical Order

 A   B   C   D   E   F   G   H   I   J   K   L   M  

N   O   P   Q   R   S   T   U   V   W   X   Y   Z  

Show / Hide Filmy icons selection options

Click on following links to open cliparts by Alphabetical Order

  A   B   C   D   E   F   G   H   I   J   K   L   M  

N   O   P   Q   R   S   T   U   V   W   X   Y   Z  

Username: Posting Information:
This is a private posting area. Only registered users and moderators may post messages here.
Password:
Options: Enable HTML code in message
Automatically activate URLs in message
Action: