Help needed in Korn Shell scripting


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Help needed in Korn Shell scripting
# 1  
Old 02-25-2013
Code Help needed in Korn Shell scripting

Code:
#! /bin/ksh

while read line
do
  if [[ ${#line} -lt 45 ]] ; then
   echo "no data"
   continue;
  fi
  echo "performing operation on $line"
done < prg.txt

# 2  
Old 02-25-2013
Ok. What is your question?
# 3  
Old 02-25-2013
Want a Korn shell script which reads the records in a file and at a specific position it is to be checked whether tht is blank.
eg-

dhgadjhkwdkwyuywu gdwyduyweeduy
xvgjdwtdjtwktdtwtdt udedeiueduuedu

suppose tht one line in file is of 100 characters nd position 20-28 have to be checked for blank or empty string.

Please help...
using awk will be preferred

---------- Post updated at 06:57 AM ---------- Previous update was at 06:55 AM ----------

the above code is what i have tried but tht works only if the position we are checking is the last position in the file
# 4  
Old 02-25-2013
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help Needed with File Checker Korn Shell Script

I am attempting to write a korn shell script that does the following, but I am getting errors. I'm new to korn shell scripting and am not sure what I am doing wrong. Please help with example scripts. Thanks. 1) check for day of the week 2) if day of the week is Monday then check for the... (4 Replies)
Discussion started by: ijmoore
4 Replies

2. Homework & Coursework Questions

korn shell scripting

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: There is a menu driven program and there are some fields to be achived 3. Display contents of all .lst files... (3 Replies)
Discussion started by: jainitai
3 Replies

3. UNIX for Advanced & Expert Users

Comparison in Korn shell scripting

I have a scenario to implement in Korn shell script. Here it is.. I need to compare two values to see whether they are same or not. The issue is that the values coming in for comparison can be a string or an integer which can be determined during run time only. Which korn shell comparison... (2 Replies)
Discussion started by: vani123
2 Replies

4. Shell Programming and Scripting

Korn shell scripting

I am attempting to learn shell programming using o'rielly book "Learning the Korn Shell". I am finding it pretty difficult to do since the only access I have to unix boxes are running version 99 of ksh. The book utilizes ksh93 and there appear to be many differences. I can't even follow along... (2 Replies)
Discussion started by: vedder191
2 Replies

5. Shell Programming and Scripting

Solaris Korn Shell Scripting

I have made the following simple script: a=0 let a=$a+1 if "] then mailx -s "Up" abc@yahoo.com fi When I run the above script, I get the following error: # ./new.ksh ./new.ksh: ]: not found. Please tell me how to use if here? (6 Replies)
Discussion started by: kamaldeep1986
6 Replies

6. Shell Programming and Scripting

Korn Shell script needed

Hi all, I need a Korn Shell script that will go out to all Unix Servers and pull all non humans IDs from them while at the same time produce a file to show which servers we have access to and which ones we don't. Thanks in advance. (5 Replies)
Discussion started by: vinsara
5 Replies

7. UNIX for Dummies Questions & Answers

Help with Korn Shell Scripting

Hi I'm new to scripting and I don't know where to start. I need to create a script that needs to look for specific files in a specific folder then I need to return the filename, the recordcount, bytecount and checksums. Then I need to write these results into a new file. I would appreciate... (2 Replies)
Discussion started by: th0123
2 Replies

8. Shell Programming and Scripting

Help needed in character replacement in Korn Shell

How do I replace a space " " character at a particular position in a line? e.g. I have a file below $ cat i2 111 002 A a 33 0011 B c 2222 003 C a I want all the 1st spaces to be replaced with forward slash "/" and the 3rd spaces to have 5 spaces to get the output below: 111/002... (8 Replies)
Discussion started by: stevefox
8 Replies

9. Shell Programming and Scripting

Repost-Korn Shell Scripting

Hi, being very new to Korn Shell Scripting I am hoping that someone here can help me. I want to compare file name in scp/inbox directory to file name stored inside a file in pnt/compare directory. Hi, being very new to Korn Shell Scripting I am hoping that someone here can help me. I want to... (1 Reply)
Discussion started by: hanie123
1 Replies

10. Shell Programming and Scripting

Korn Shell Help Needed

How do I change directories to a path given by input variable in Korn Shell? e.g. I tired with the Korn Shell below but it doesn't work. ---------------------------------- #!/bin/ksh echo "Enter folder name: \c" read folder cd $folder ---------------------------------- Any help will... (5 Replies)
Discussion started by: stevefox
5 Replies
Login or Register to Ask a Question