Skip to main content

All Questions

Tagged with
0 votes
5 answers
1k views

How to ignore all text containing special character more than once?

Sample Input: apple_ig rabbit_cat_ig dog_ig bird_duck_ig orange_ig goat_ig Expected output: apple_ig dog_ig orange_ig goat_ig I need to ignore all data that contains underscore _ more than once in ...
ayrton_senna's user avatar
  • 1,091
0 votes
3 answers
4k views

How to compare string to a wild card string in shell script?

I want to compare file name string with file mask in a ksh shell script. Can you please correct the syntax? if [ "NPER20200422TEST.PTN" = "NPER*.PTN" ] then echo "File ...
user3548033's user avatar
-3 votes
2 answers
246 views

Extract string followed by specific word/symbol

I have two lines as shown below in my input file input.txt and I need to extract claimStartDate from first line and claimEndDate from second line. <ProfessionalClaim paymentIndicator="P" ...
Velava Shanmugam's user avatar
2 votes
1 answer
1k views

Align columns evenly without "column - t"

I have an output file created from a Korn shell script. I need to align the output with spaces evenly. Unfortunately column -t is not available on AIX. Actual File: X1vir1000 x1-DFB127 ...
satsensort's user avatar
1 vote
3 answers
2k views

Passing vars to awk

I have huge file that needs to be split into multiple files. I'm using split, which is working fine file=home/sap/dim/deltafile.D2017313.T100058932IDL.gz gunzip -c ${file} | split -l 10000000 -d -a ...
mcky mini's user avatar
1 vote
2 answers
4k views

How to cut every line from a particular string?

input.txt: john_Apple01_xyz_1 john_Fruit_Apple01_abc_c1 john_Apple21_trs_1 john_Fruit_Apple21_efg_1 john_Fruit_Apple21_tefg_1 Desired output: Apple01_xyz_1 Apple01_abc_c1 Apple21_trs_1 Apple21_efg_1 ...
ayrton_senna's user avatar
  • 1,091
2 votes
1 answer
4k views

How to make awk work in a while loop

input.txt: /usr/dir1/file1 /usr/dir1/file2 /usr/dir2/file4 /usr/dir3/file5 Script: cat input.txt |while read FILENAME do nawk '{print $1}' ${FILENAME} >> output.txt done Expected output: all ...
ayrton_senna's user avatar
  • 1,091
1 vote
1 answer
6k views

Compare two Arrays in KSH and output the difference

I am not extremely familiar with KSH (Actually just started using it) and I am having problems with trying to create a script that will essentially compare two arrays that have been stored and then ...
Christopher Stanley's user avatar
2 votes
2 answers
142 views

Awk not rendering any result

My goal is to get the file created in the current month in a directory. It seems that the command is correct but not rendering any result: Date=`date '+%b'` echo $Date Oct ls -l | awk -v d="$Date" ...
Ram's user avatar
  • 383
1 vote
3 answers
2k views

linux/solaris + verify duplicate valid IP address from file

what the best way to find duplicate IP from file ( I have ksh script in this script I need to write function that check for duplicate IP ) for example if IP - 192.1926.23.52 exists twice in file - ...
yael's user avatar
  • 1,325