Sponsored Content
Top Forums Shell Programming and Scripting Help with ksh-to read ip file & append lines to another file based on pattern match Post 302833285 by RudiC on Tuesday 16th of July 2013 05:18:42 PM
Old 07-16-2013
Try
Code:
while read col1 col2 col3 rest
   do
   case $col3 in
     (white) printf "%s\n%s\n" "*colors are random: yes" "*colors are light: yes";;
     (brown) printf "%s\n%s\n" "*colors are dark: no" "*colors are random: no:" ;;
     (*)     continue;;
   esac
   done <input.txt >>insert.txt

This User Gave Thanks to RudiC For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

read from a specific pattern from one file and append it to another

Hi! Everyone, Say this file1 -------------- line 1 51610183 420001010 0010CTCTLEDPPOO 2151610183 line 2 2151610183 420001010 0030A2TH2 line 3 2151610183 420001010 0040A2TH3 line 4 2151610183 420001010 ... (0 Replies)
Discussion started by: kinkar_ghosh
0 Replies

2. Shell Programming and Scripting

Merge two file data together based on specific pattern match

My input: File_1: 2000_t g1110.b1 abb.1 2001_t g1111.b1 abb.2 abb.2 g1112.b1 abb.3 2002_t . . File_2: 2000_t Ali england 135 abb.1 Zoe british 150 2001_t Ali england 305 g1111.b1 Lucy russia 126 (6 Replies)
Discussion started by: patrick87
6 Replies

3. Shell Programming and Scripting

deleting lines in a file that match a pattern without opening it

In Unix, how do I delete lines in a file that match a particular pattern without opening it. File contents are foo line1 misc whatever foo line 2 i want to delete all lines that have the pattern "foo" without opening the file. File should eventually contain misc whatever (1 Reply)
Discussion started by: osbourneric
1 Replies

4. Shell Programming and Scripting

Delete lines based on pattern match

BASH in Solaris 10 I have a log file like below. Whenever the pattern ORA-39083 is encountered, I want to delete the line which has this pattern and 3 lines below it. $ cat someLogfile.txt ORA-39083: Object type OBJECT_GRANT failed to create with error: ORA-01917: user or role 'CMPA' does... (4 Replies)
Discussion started by: kraljic
4 Replies

5. Shell Programming and Scripting

Match and Append Based on file contexts

Not Sure how to do this. Some combo of awk and sed perhaps. If String in File1 match String in file2 then append file2 File1.txt BullTerrier Boxer Bulldog File2.txt <Defined info="AllAnimals" group="Adoptions" setting="animals"> <SomeID ="NumbersRepresentingDogName"> <for> <add... (2 Replies)
Discussion started by: TY718
2 Replies

6. Shell Programming and Scripting

Obtain pattern from file; Append 1st Match

Not clear how to do so. Looking to append the 1st match of said pattern with 'OK TO REMOVE' file containing patter File1.txt RMS_QUANTITY_RT SMS_QUANTITY_RT file to search File2.txt <!-- dec=664, SMS_QUANTITY_RT --> <!-- dec=664, RMS_QUANTITY_RT --> Projected Results <!--... (3 Replies)
Discussion started by: TY718
3 Replies

7. Shell Programming and Scripting

Match all lines in file where specific text pattern is less than

In the below file I am trying to grep or similar, all lines where only AF= is less than 0.4.. Thank you :). grep grep "AF=" ,+ .4 file file 12 112036782 . T C 34.0248 PASS ... (3 Replies)
Discussion started by: cmccabe
3 Replies

8. Shell Programming and Scripting

awk to update value based on pattern match in another file

In the awk, thanks you @RavinderSingh13, for the help in below, hopefully it is close as I am trying to update the value in $12 of the tab-delimeted file2 with the matching value in $1 of the space delimeted file1. I have added comments for each line as well. Thank you :). awk awk '$12 ==... (10 Replies)
Discussion started by: cmccabe
10 Replies

9. UNIX for Beginners Questions & Answers

Match pattern only between certain lines in entire file

Hello, I have input that looks like this: * 0 -1 103 0 0 m. 7 LineNr 23 ClauseNr 1: 1: 1: 304: 0 0 SentenceNr 13 TxtType: Q Pargr: 2.1 ClType:MSyn PS004,006 ZBX= 0 1 1 0 7 -1 -1 3 2 3 2 -1 1 1 -1 -1 -1 -1 0 501 0 PS004,006 ZBX ... (2 Replies)
Discussion started by: jvoot
2 Replies

10. UNIX for Beginners Questions & Answers

UNIX script to append multiple text files into one file based on pattern present in filaname

Hi All-I am new to Unix , I need to write a script. Can someone help me with a requirement where I have list of files in a directory, I want to Merge the files if a pattern of string matches in filenames? AAAL_555A_ORANGE1_F190404.TXT AAAL_555A_ORANGE2_F190404.TXT AAAL_555A_ORANGE3_F190404.TXT... (6 Replies)
Discussion started by: Shankar455
6 Replies
pbmclean(1)						      General Commands Manual						       pbmclean(1)

NAME
pbmclean - flip isolated pixels in portable bitmap SYNOPSIS
pbmclean [-minneighbors=N] [-black|-white] [pbmfile] You can use the minimum unique abbreviation of the options. You can use two hyphens instead of one. You can separate an option name from its value with white space instead of an equals sign. Before December 2001, pbmclean accepted -N instead of -minneighbors. DESCRIPTION
pbmclean cleans up a PBM image of random specs. It reads a PBM image as input and outputs a PBM that is the same as the input except with every pixel which has less than N identical neighbours inverted. The default for N is 1 - only completely isolated pixels are flipped. (A value of N greater than 8 generates a completely inverted image (but use pnminvert to do that) -- or a completely white or completely black image with the -black or -white option). pbmclean considers the area beyond the edges of the image to be white. (This matters when you consider pixels right on the edge of the image). You can use pbmclean to clean up "snow" on bitmap images. OPTIONS
-black -white Flip pixels of the specified color. By default, if you specify neither -black nor -white, pbmclean flips both black and white pix- els which do not have sufficient identical neighbors. If you specify -black, pbmclean leaves the white pixels alone and just erases isolated black pixels. Vice versa for -white. You may specify both -black and -white to get the same as the default behavior. SEE ALSO
pbm(5) AUTHOR
Copyright (C) 1990 by Angus Duggan Copyright (C) 1989 by Jef Poskanzer. Copyright (C) 2001 by Michael Sternberg. Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, pro- vided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in sup- porting documentation. This software is provided "as is" without express or implied warranty. 18 Oct 2001 pbmclean(1)
All times are GMT -4. The time now is 01:03 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy