Print a line where missing!!


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Print a line where missing!!
# 1  
Old 08-21-2013
Print a line where missing!!

Hi,
I have a file whihc looks like
Code:
file_1 100 200
file_2 200 300
file_4 400 500

as the file_3 is missing so I want to replace it by
file_3 0 0

the final output would look like
Code:
file_1 100 200
file_2 200 300
file_3 0 0
file_4 400 500

Any help is highly appreciated.

Regards,

Last edited by Franklin52; 08-21-2013 at 07:28 AM.. Reason: Please use code tags
# 2  
Old 08-21-2013
Seems like a duplicate thread. Posted a solution here
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk to print missing and keep sequential ordering if not found

The below awk in bold will look for the ids in file1 in $2 of file2 and if they match print the line in file2. If an id is missing or not found in file2 (like BMPR2 in line4 of file1) I can not figure out how to add it to them to the lines in the output as missing in $3 following the same format.... (4 Replies)
Discussion started by: cmccabe
4 Replies

2. Shell Programming and Scripting

Print Missing Header Name from File.

HI Guys, I have file A.txt ID,L1,L2,L3,L4 1A,2a,33a,44b,55c 2A,10a,14a,15b,16c File B.txt ID L1 L4 L5 Output:- ID,L1,L4,L5 (2 Replies)
Discussion started by: pareshkp
2 Replies

3. Shell Programming and Scripting

How to print the missing fields outside the for loop in Korn shell?

I have 2 for loop in my program , first one will list files based on timestamp and second one list the files based on type(RPT / SUB_RPT).Here is my code: #!/bin/ksh STG_DIR=/home/stg for pattern in `find $STG_DIR -type f -name 'IBC*csv' | awk -F'' '{print $(NF-1)}' | sort -u` do echo... (2 Replies)
Discussion started by: ann15
2 Replies

4. Shell Programming and Scripting

Looking for an awk command to print strings only if substring is missing

I have a file that I need to find each interface that has move-group on the interface line and print this line if the lines under the interface does Not have "filter-shared 14". Example file: interface 1/1/1/0 move-group decription one one one zero no shut filter-shared 14... (21 Replies)
Discussion started by: numele
21 Replies

5. UNIX for Dummies Questions & Answers

Find the missing file and print

Hi , i will be getting 24 files for one day with a formate like 20131028_01 - 20131028_24 kind of ,i am trying to write a shell script to count the number of files and if the count is not equal to 24 print the missing files names for A in `seq 0 23`; do ls *20131024_`printf "%02d" $A`*;... (3 Replies)
Discussion started by: vikatakavi
3 Replies

6. Shell Programming and Scripting

print out missing files in a sequence

Hello all, I have several directories with a sequence of files like this IM-0001-0001.dcm IM-0001-0002.dcm IM-0001-0003.dcm IM-0001-0004.dcm IM-0001-0005.dcm I would like to print out the name of the file that is missing. I currently have the following ineffecient way to do this... (4 Replies)
Discussion started by: avatar_007
4 Replies

7. UNIX for Dummies Questions & Answers

Missing print binary/executable

Hi friends, I am trying to execute some of our scripts and apparently I had this error message: bash: print: command not found Every other scripts runs smoothly excepts this that uses the print command. I search the /bin and it was not there. I also tried to search in the whole folder... (5 Replies)
Discussion started by: kokoro
5 Replies

8. Shell Programming and Scripting

command-line line 0: Missing yes/no argument

Hi Guys When I run the below command ssh -o 'PasswordAuthentication yes' -o 'PreferredAuthentications publickey' -i $HOME/.ssh/id_dsa Server_Name I found the below error ommand-line line 0: Missing yes/no argument Kindly help me to sort out Double post, continued... (0 Replies)
Discussion started by: Pratik4891
0 Replies

9. Shell Programming and Scripting

Scan two files and print values missing

Dear Experts, Have been seraching this forum from this morning for my query but dint find hence posting it her... Basically i have two input files BSS and MSS which has a unique string , hence i hav tried and seperated the text to compare frm both files .. Any my present input files look like... (6 Replies)
Discussion started by: shaliniyadav
6 Replies

10. Shell Programming and Scripting

Awk not working due to missing new line character at last line of file

Hi, My awk program is failing. I figured out using command od -c filename that the last line of the file doesnt end with a new line character. Mine is an automated process because of this data is missing. How do i handle this? I want to append new line character at the end of last... (2 Replies)
Discussion started by: pinnacle
2 Replies
Login or Register to Ask a Question