PLEASE PLEASE Help - Automate text manipulation process


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting PLEASE PLEASE Help - Automate text manipulation process
# 1  
Old 02-20-2009
Data PLEASE PLEASE Help - Automate text manipulation process

I am trying to automate a process (on windows OS) of manipulating a file by changing its column delimiters. I have a perl script ready but the problem i think is with the format of the file itself.

code:
#! usr/bin/perl -w
foreach (<STDIN>) {

#copy this line:
my $line = $_;

# replace every tab with ^
while ($line =~ s/"\t"/^ / ) { }

# remove double quotation marks
while ($line =~ s/"//) { }

print $line
}

Sample of the input file (one line of data)

Code:
"12722"    "New"    "Major"    "Unassigned"    "Computer Manager"    "Unassigned"    "4.1.1"    ""    "library"    "Bruce Borth"    "Jan 7, 2008 10:27 AM"    "Jan 11, 2008 1:50 PM"    "Unassigned"    "Library function does not have the ability to create a library without enabling it - Liraries do not depend on other lib messge missing details"    ""    ""    "Defect"

Sample output for the same line

Code:
12722ऀ Newऀ Majorऀ Unassignedऀ Computer Managerऀ Unassignedऀ 4.1.1ऀ ऀ libraryऀ Bruce Borthऀ Jan 7, 2008 10:27 AMऀ Jan 11, 2008 1:50 PMऀ Unassignedऀ Library function does not have the ability to create a library without enabling it - Liraries do not depend on other lib messge missing detailsऀ ऀ ऀ ऀ ऀ ऀ Defectഀ
㄀㌀㄀㔀㐀     一攀眀     一漀爀洀愀氀     䴀攀搀椀甀洀     刀愀琀椀漀渀愀氀 䄀猀猀攀琀 䴀愀渀愀最攀爀     匀攀爀瘀攀爀     㜀⸀㄀⸀㄀     㜀⸀㄀⸀㄀⸀㄀ 䐀攀瘀          匀愀甀爀愀戀栀 䄀最愀爀眀愀氀     䨀愀渀 ㈀ Ⰰ ㈀  㤀 㐀㨀㐀㔀 倀䴀     䨀愀渀 ㈀ Ⰰ ㈀  㤀 㐀㨀㐀㘀 倀䴀     唀渀愀猀猀椀最渀攀搀     唀猀攀爀 椀猀 愀氀氀漀眀攀搀 琀漀 搀漀眀渀氀漀愀搀 琀栀攀 愀猀猀攀琀 攀瘀攀渀 琀栀漀甀最栀 椀昀 琀栀攀礀 搀漀渀琀 栀愀瘀攀 瀀攀爀洀椀猀猀椀漀渀               䐀攀昀攀挀琀 ਍

The only way of making this work is if i copy the original input file into a notepad2.exe and then saving it and running the perl script on that file. The problem is i need to automate this process.

Can anyone tell me what are these squares and why are they appearing?
# 2  
Old 02-22-2009

Why not use a simple sed command:

Code:
sed -e 's/"\t*"/^/g' -e 's/"//g' FILE

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script to automate recovery process

Hello All! First post... I am working on a script that is used to recover a crashed drive from an rsync backup. I'm down to the place where I need to create all of the directories in /mnt where I will then mount each of the volumes and begin the restore process to each volume... I have... (3 Replies)
Discussion started by: RogerBaran
3 Replies

2. UNIX for Dummies Questions & Answers

Automate sftp process using script

Hi, guys, I am trying to automate a sftp process using "expect" method (since the key authentication method is disabled in my company network, there is no helping it). In order to try, I type in the command manually: sftp @ > << EOF >cd >ls -l >EOF >Connecting to @servername password: ... (3 Replies)
Discussion started by: warmboy610
3 Replies

3. Shell Programming and Scripting

Need help in creating a shell script to automate svnstats process

Hi, I am trying to create a shell script to automate the following process of getting svn stats:- Step1:- cd to checkout location. Note that the checked code have multiple modules in respective folders Step2:- Execute this command inside each module:- svn log -v --xml >... (0 Replies)
Discussion started by: d8011
0 Replies

4. Shell Programming and Scripting

Automate the process of running jobs on several directories consecutively

Hi, I have about 10 directories in which I run the same code. But this code is only run in a directory when the computation in the previous directory was successful (explained below). My directories are named as : VF_50, VF_100, VF_150, VF_200............. As you can see the number after _... (6 Replies)
Discussion started by: lost.identity
6 Replies

5. UNIX for Dummies Questions & Answers

To automate a process

CAN ANYONE HELP TO SOLVE i wann write a script to automate a process .i.e, to search files in the FTP server and and if files are there and we hav to bring that files to our system. After copying the files in our system we have to upload the data in the tables. I have scripts to load the... (2 Replies)
Discussion started by: nani1984
2 Replies

6. UNIX for Advanced & Expert Users

TO Automate the FTP process

Plzz Some One Help in this matter I have scripts to load the data into tables and to copy files from ftp to our system. we use to run the scripts every day.... we hav the files in the FTP server and we hav to bring the files to our system and we hav to load the data into the tables. We... (0 Replies)
Discussion started by: nani1984
0 Replies

7. Shell Programming and Scripting

To automate a process

CAN ANYONE HELP TO SOLVE i wann write a script to automate a process .i.e, to search files in the FTP server and and if files are there and we hav to bring that files to our system. After copying the files in our system we have to upload the data in the tables. I have scripts to load the... (0 Replies)
Discussion started by: nani1984
0 Replies

8. Shell Programming and Scripting

Automate Log Monitoring Process

I am a new member of this forum and am also new to unix shell scripting. I joined the forum to seek for help to achieve my task as this forum helps people. here's what i do manually on daily basis 1)Loginto different unix box 2)Ftp the log files (morethan 50 each dir) to windows 3)use text pad... (3 Replies)
Discussion started by: sharugan
3 Replies

9. IP Networking

Automate FTP process and autorestart on link failure

Hi Guys, i have this lil challenge; i am to implement an automated script that searches/scans a directory for files then picks and sends this files to a very remote server via an ftp link. the challenge here is that the ftp link fails due to netwrk issues maybe; i therefore need to develop... (5 Replies)
Discussion started by: sdcoms
5 Replies

10. Shell Programming and Scripting

How to automate an FTP process?

Hello script experts, I am newbie to shell script. But I have to write a shell script (ASAP) where I need to ftp a file on daily basis to a remote server, and send an email with final status. I I should have a properties file with hostname, Userid, and pwd. And a shall script file should read... (1 Reply)
Discussion started by: ksak
1 Replies
Login or Register to Ask a Question