Unix/Linux Go Back    


Shell Programming and Scripting Unix shell scripting - KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and shell scripts and shell scripting languages here.

override protection 644 (yes/no)?

Shell Programming and Scripting


Closed Linux or Unix Question    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 01-23-2011
sri_aue sri_aue is offline
Registered User
 
Join Date: Jan 2011
Last Activity: 4 July 2012, 5:19 PM EDT
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
override protection 644 (yes/no)?

Hi pls help me out to short out this problem


rm PAB113_011.out
rm: PAB113_011.out: override protection 644 (yes/no)? n

If i give y it remove the file.

But i added the rm command as a part of ksh file and i tried to remove the file. Its not removing and the the file prompting as below

joly!edwopr(Dv03) /apps/edw/Direct_DW/Dv03/output
==> ksh test.ksh
hi
rm: /apps/edw/Direct_DW/Dv03/output/ is a directory
rm: PAB113_011.out: override protection 644 (yes/no)?


is there anyway to give 'yes' in the script level itself.
Sponsored Links
    #2  
Old Unix and Linux 01-23-2011
daPeach daPeach is offline
Registered User
 
Join Date: Aug 2009
Last Activity: 19 August 2015, 3:37 PM EDT
Posts: 143
Thanks: 2
Thanked 13 Times in 13 Posts
Hi,

in bash, you'll adapt if needed to KSH:
Code:
while IFS='|' read -r -a array; do printf '%s\n' "${array[@]}"; done < yourSample
aaaaa 
erereer<5spaces>ooo
tteererer<4spaces>ooooo
rrererere<6SPACES>oo<6SPACES>oo<6SPACES>oo<6SPACES>oo<6SPACES>oo
eeee


Code:
tr '|' $'\n' < yourSample

same output
Sponsored Links
    #3  
Old Unix and Linux 01-23-2011
Franklin52's Unix or Linux Image
Franklin52 Franklin52 is offline Forum Staff  
Moderator
 
Join Date: Feb 2007
Last Activity: 25 August 2015, 9:05 AM EDT
Location: The Netherlands
Posts: 7,732
Thanks: 129
Thanked 549 Times in 516 Posts

Code:
tr '|' '\n' < infile > outfile

    #4  
Old Unix and Linux 01-23-2011
sri_aue sri_aue is offline
Registered User
 
Join Date: Jan 2011
Last Activity: 4 July 2012, 5:19 PM EDT
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
echo $line | tr '|' '\n' >> $2

Hi I am already using this in my code. My problem is get the same spaces as in the input file.

please replace the <6spaces> with spaces when trying the code and let me know the solution ,..

Waiting for ur response
Sponsored Links
    #5  
Old Unix and Linux 01-23-2011
daPeach daPeach is offline
Registered User
 
Join Date: Aug 2009
Last Activity: 19 August 2015, 3:37 PM EDT
Posts: 143
Thanks: 2
Thanked 13 Times in 13 Posts
your problem is that you don't quote $line.
Use More Quotes!
Sponsored Links
    #6  
Old Unix and Linux 01-23-2011
grepeverything grepeverything is offline
Registered User
 
Join Date: Jan 2011
Last Activity: 25 September 2011, 3:17 PM EDT
Posts: 14
Thanks: 0
Thanked 2 Times in 2 Posts
Maybe this would also work for you:
Quote:
egrep -o '[^|]+' infile > outfile
(or use grep -Eo ... instead of egrep)
The grep basically says just print the matched pattern, which is anything but a pipe symbol ("[^|]", repeated more than one time, "+".
Sponsored Links
    #7  
Old Unix and Linux 01-23-2011
Franklin52's Unix or Linux Image
Franklin52 Franklin52 is offline Forum Staff  
Moderator
 
Join Date: Feb 2007
Last Activity: 25 August 2015, 9:05 AM EDT
Location: The Netherlands
Posts: 7,732
Thanks: 129
Thanked 549 Times in 516 Posts
Quote:
Originally Posted by sri_aue View Post
echo $line | tr '|' '\n' >> $2

Hi I am already using this in my code. My problem is get the same spaces as in the input file.

please replace the <6spaces> with spaces when trying the code and let me know the solution ,..

Waiting for ur response
Don't use a loop, this is sufficient:

Code:
#!/bin/ksh

tr '|' '\n' < $1 > $2

Sponsored Links
Closed Linux or Unix Question

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to override my profile mobile01 Programming 0 11-30-2006 10:35 AM
override the function in C naren_chella Programming 1 10-31-2006 08:38 AM
date override gerry shacter AIX 1 01-09-2006 12:42 AM
Override Mulo IP Networking 1 03-10-2002 08:56 PM
Override protection..... Makaveli.2003 UNIX for Dummies Questions & Answers 1 01-23-2002 01:37 PM



All times are GMT -4. The time now is 10:14 PM.