Any unix/perl experts?? Chalanachithram.com | Topics | Search
Hide Clipart | Log Out | Register | Edit Profile

Last 30 mins | 1 | 2 | 4 hours     Last 1 | 7 Days

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

Author Message
Top of pagePrevious messageNext messageBottom of page Link to this 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:   Insert Quote Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)Ban Poster IP (Moderator/Admin only)


Trueleader:




thanks annnai
Top of pagePrevious messageNext messageBottom of page Link to this message

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:   Insert Quote Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)Ban Poster IP (Moderator/Admin only)

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;
Top of pagePrevious messageNext messageBottom of page Link to this message

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:   Insert Quote Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)Ban Poster IP (Moderator/Admin only)


Goonda:




thanks bhayya
Top of pagePrevious messageNext messageBottom of page Link to this message

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:   Insert Quote Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)Ban Poster IP (Moderator/Admin only)


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
Top of pagePrevious messageNext messageBottom of page Link to this message

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:   Insert Quote Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)Ban Poster IP (Moderator/Admin only)


Linkmaster:

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




sed -i 's/\'/\n/' anukunta
Top of pagePrevious messageNext messageBottom of page Link to this message

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:   Insert Quote Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)Ban Poster IP (Moderator/Admin only)


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
Top of pagePrevious messageNext messageBottom of page Link to this message

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:   Insert Quote Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)Ban Poster IP (Moderator/Admin only)

cat file.txt | sed -i 's/\'/\n/' >> result.txt
Top of pagePrevious messageNext messageBottom of page Link to this message

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:   Insert Quote Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)Ban Poster IP (Moderator/Admin only)


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
Top of pagePrevious messageNext messageBottom of page Link to this message

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:   Insert Quote Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)Ban Poster IP (Moderator/Admin only)


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
Top of pagePrevious messageNext messageBottom of page Link to this message

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:   Insert Quote Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)Ban Poster IP (Moderator/Admin only)


Maverick:

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




sed -i 's/\'/\n/' filename
Top of pagePrevious messageNext messageBottom of page Link to this message

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:   Insert Quote Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)Ban Poster IP (Moderator/Admin only)


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
Top of pagePrevious messageNext messageBottom of page Link to this message

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:   Insert Quote Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)Ban Poster IP (Moderator/Admin only)


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
Top of pagePrevious messageNext messageBottom of page Link to this message

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:   Insert Quote Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)Ban Poster IP (Moderator/Admin only)

//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!
Top of pagePrevious messageNext messageBottom of page Link to this message

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:   Insert Quote Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)Ban Poster IP (Moderator/Admin only)

is it something like'break from here

to

is it something like
break from here
Top of pagePrevious messageNext messageBottom of page Link to this message

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:   Insert Quote Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)Ban Poster IP (Moderator/Admin only)


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
Top of pagePrevious messageNext messageBottom of page Link to this message

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:   Insert Quote Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)Ban Poster IP (Moderator/Admin only)


Sachin:

Any unix/perl experts??




Mav manchi expert anukunta
Top of pagePrevious messageNext messageBottom of page Link to this message

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:   Insert Quote Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)Ban Poster IP (Moderator/Admin only)

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(0x882b214){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: