Questions tagged [korn]

12 questions
1
vote
1 answer

Setting the date of a file to that of the previous month - KornShell

Im trying to set up a KornShell script so a file is FTP'd on the first of each month. When the file is created it should read the date of the previous month - If the job was ran on April 1st the file would be filename_MAR2023. Is this something that…
STAKD
  • 15
  • 4
1
vote
2 answers

AIX sed - find exact match and replace

I need to use sed on AIX to find and replace exact match of a string. as an example we have a like like below LogicalVolume hdisk1 hdisk10 and I have 2 variables old_disk=hdisk1 new_disk=hdisk50 Here is the sed command I would like to use sed…
1
vote
3 answers

change date in column 2 where numbers do not match column 3

I have tried this before but need to change direction. I was changing the numbers but I found I need to change the date after the numbers differ. My text has 3 columns and the 2nd and 3rd are similar but occasionally there is a 1 - 4 digit number…
fletching
  • 31
  • 4
1
vote
1 answer

Korn Shell change date from a file

I recently had a question that was answered but I was writing in shell with cygwin. I found out I need to make this krn Shell compatible for MKS Toolkit. The sed command does not like this and I am looking for a solution. the file is such that…
fletching
  • 31
  • 4
0
votes
2 answers

IF/ELIF/ELSE Statement Korn Shell

Ive had experiences running these statements in the past but not loads. Im trying to run one that will look in the directory and if the file is a .txt then send it to testdir_2 else if it is a .csv file then send to testdir_3. Else if it is anything…
STAKD
  • 15
  • 4
0
votes
1 answer

Inserting a Comment text to a table using KSH shell

I have a script where it is necessary to add now in the current statement a received COMMENT text from the user as parameter. Below is an example but it is failing. Can someone help me with this ? \#!/usr/bin/ksh export COMMENTS=${1} echo…
0
votes
1 answer

ksh : pattern should not match but it does

I'm unable to understand why the following pattern matches here: $ [[ "abcdef12" == ab!(cd)* ]] && echo matched matched According to the man page (unless I've misunderstood something) it should not : !(pattern-list) Matches anything except one of…
Gilles Pion
  • 166
  • 1
  • 8
0
votes
1 answer

Linux: $* is not preserving the group of words as single argument

I am having a parent script and a child script, Parent script: echo 'Parent script 1st arg '$1 echo 'Parent script 2nd arg '$2 PARAMS=$* ksh child_script.ksh $PARAMS Child script: echo 'Child script 1st arg '$1 echo 'Child script 2nd arg '$2 I am…
Dev Anand
  • 314
  • 1
  • 14
0
votes
1 answer

korn script options not finding getopts correctly

I have a korn script that does this: testing.ksh: m_Ftp -t'echo "No skipping"' -f DEV_OVR MMMM <
Michele
  • 3,617
  • 12
  • 47
  • 81
0
votes
1 answer

lftp using input file for command input not working

I'm trying to convert from kermit to lftp. The old script takes the commands from another script for to/from location for the files. I want to still take that input file, but I'm having trouble getting it to read commands from the input file. old…
Michele
  • 3,617
  • 12
  • 47
  • 81
-1
votes
1 answer

user input into sed command via variable

I had this question before and used @HatLess answer when it was going to be static. It needs to be user input and I have tried the script but I am having issues as it tells me file not found and several other messages depending on what I change. I…
fletching
  • 31
  • 4