Problem getting the required output


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Problem getting the required output
# 1  
Old 02-26-2013
Problem getting the required output

I need a Korn shell script which does the folllowing:-

If there is one "|" (pipe) delimited file so, the script should check the 5th field to be blank or not. if it is a blank tht entire line of the file should be redirected to another file. if the 5th field is not blank it should pass that.

---------- Post updated at 10:07 AM ---------- Previous update was at 10:05 AM ----------

i tried something like this :-
Code:
cut -d "|" -f5 inputfile > files

but this is not providing the correct output as it is displaying only the 5th field not the entire line.

---------- Post updated at 10:07 AM ---------- Previous update was at 10:07 AM ----------

Can anyone pls help on this?

Last edited by Franklin52; 02-26-2013 at 11:08 AM.. Reason: Please use code tags for data and code samples
# 2  
Old 02-26-2013
Bumping up posts or double posting is not permitted in these forums.

Please read the rules, which you agreed to when you registered, if you have not already done so.

Thank You.

The UNIX and Linux Forums.
# 3  
Old 02-26-2013
Code:
awk -F"|" '$5 == "" { print > "blankfile"; next } 1' inputfile > notblankfile

# 4  
Old 02-27-2013
thanx Corona688 SmilieSmilie

---------- Post updated at 08:53 AM ---------- Previous update was at 08:53 AM ----------

i need one more help? can anyone please help?
# 5  
Old 02-27-2013
What is the question?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Required column output should be arranged in awk

dump file 2020-01-05 & 234135 ossuser 4 CACLP; 2020-01-05 & 234207 ossuser 3 CACLP; 2020-01-05 & 234307 ossuser 1002 CACLP; 2020-01-05 & 234427 ossuser 0 CACLP; 2020-01-05 & 234429 ossuser 1 CACLP; Command used awk ... (1 Reply)
Discussion started by: Sagar Singh
1 Replies

2. UNIX for Beginners Questions & Answers

Convert rows to column and print output in required format

Hi All, i am trying to print the solaris 11 packages in below required format, But i am unable to do that. Current ouput : root@abc# pkginfo -l | egrep '(BASEDIR|NAME|VERSION)' | awk '{print}' NAME: QLogic 570x/571x Gigabit Ethernet Driver VERSION: 11.11,REV=2009.11.11 ... (7 Replies)
Discussion started by: balu1234
7 Replies

3. Shell Programming and Scripting

Required formatted output on mail for disk utilization

Hi Experts, Could you pls help with below query I have written below script to capture disk utilization and then send the output on mail. But getting unformated output on mail #!/bin/bash echo "Hi Sur,">dfoutput.csv printf '\n' >>dfoutput.csv echo "Please find BAYSQUAR2 filesystem... (4 Replies)
Discussion started by: as7951
4 Replies

4. SuSE

Find command doesn't pipe the output as required.

Hi, I am using below code snippet to echo/display the files found (matching a pattern from searchstring.out file) and the corresponding owner. while read j do echo "Pattern to search is:- $j" find / -name "*$j*" |\ while read k do echo "File found is:- $k" owner=$(ls... (9 Replies)
Discussion started by: Vipin Batra
9 Replies

5. Shell Programming and Scripting

Formatting required with the output

i have a o/p from find command that needs to be formatted currently when i'm running find . -name "v.info" it is giving below o/p /o/a/b/c/v.info /o/a/b/c/d/v.info /o/aa/bb/cc/v.info /o/aa/bb/cc/dd/v.info my requirement is if v.info is coming under sub-directories it shul be... (15 Replies)
Discussion started by: nikhil jain
15 Replies

6. Shell Programming and Scripting

Script to get required output from textfile

Hi Iam running below script on one text file. usr/xpg4/bin/awk 'BEGIN {print "IP HOST_NAME SUB "} /IP IS/ {IP=$3} /local/ {HOST=$1} /PPPoE/ {SUB=$3 ;print IP, HOST, SUB} ' /Scripts/sub_report_$FILE>/Scripts/sub_final_report_.txt the output is coming as below IPHOST_NAME SUB ... (16 Replies)
Discussion started by: surender reddy
16 Replies

7. Shell Programming and Scripting

script to mail monitoring output if required or redirect output to log file

Below script perfectly works, giving below mail output. BUT, I want to make the script mail only if there are any D-Defined/T-Transition/B-Broken State WPARs and also to copy the output generated during monitoring to a temporary log file, which gets cleaned up every week. Need suggestions. ... (4 Replies)
Discussion started by: aix_admin_007
4 Replies

8. Shell Programming and Scripting

perl required output

Hi, I have a string in log file from that i need to pick the username. the string is like this-- pid 2172 tid 3124: 160: 10110847: userName : pid 2172 tid 3124: 160: 10110847: userName : pid 2172 tid 3124: 160: 10110847: userName : pid 2172 tid 3124: 160: 10110847: userName : pid... (5 Replies)
Discussion started by: namishtiwari
5 Replies

9. Shell Programming and Scripting

output required

Hi I have the following output Message man amm (9196) is calling Hello & Alert man amtrr (9197) is stopped Find amfi (19198) is cancelled Engine Item aea (19203) is notified Engine Item2 aea2 ... (8 Replies)
Discussion started by: PrasannaKS
8 Replies

10. Shell Programming and Scripting

help me how to use nawk for required output

Hi all i have 2 input files 1st file is N1 | N2|N3|N4|N5|N6|N7|N8|N9 4041491000|245160|1|0|0|1|0|0|0 4041401505|152178|1|1|1|1|0|0|0 4041450004|014052|1|1|1|1|0|0|0 4041450005|580916|1|1|1|1|0|0|0 4041491000|230990|1|0|1|1|0|0|0 4041460001|338317|1|1|1|1|0|0|0 2nd file N1 |... (8 Replies)
Discussion started by: dodasajan
8 Replies
Login or Register to Ask a Question