Sponsored Content
Top Forums Shell Programming and Scripting Delete file2.txt from file1.txt using scripting Post 302734345 by itkamaraj on Thursday 22nd of November 2012 01:43:55 AM
Old 11-22-2012
Code:
 
 $ awk 'NR==FNR{a[$0]++;next}{if (!($0 in a))print}' db.txt country.txt 
United Arab Emirates
United Kingdom

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

delete lines from file2 beginning w/file1

I've been searching around here and other places, but can't put this together... I've got a unique list of words in file 1 (one word on each line). I need to delete each line in file2 that begins with the word in file1. I started this way, but want to know how to use file1 words instead... (13 Replies)
Discussion started by: michieka
13 Replies

2. UNIX for Dummies Questions & Answers

echo "ABC" > file1.txt file2.txt file3.txt

Hi Guru's, I need to create 3 files with the contents "ABC" using single command. Iam using: echo "ABC" > file1.txt file2.txt file3.txt the above command is not working. pls help me... With Regards / Ganapati (4 Replies)
Discussion started by: ganapati
4 Replies

3. Shell Programming and Scripting

sed to cp lines x->y from 1.txt into lines a->b in file2.txt

I have one base file, and multiple target files-- each have uniform line structure so no need to use grep to find things-- can just define sections by line number. My question is quite simple-- can I use sed to copy a defined block of lines (say lines 5-10) from filename1.txt to overwrite an... (3 Replies)
Discussion started by: czar21
3 Replies

4. UNIX for Dummies Questions & Answers

find lines in file1.txt not found in file2.txt memory problem

I have a diff command that does what I want but when comparing large text/log files, it uses up all the memory I have (sometimes over 8gig of memory) diff file1.txt file2.txt | grep '^<'| awk '{$1="";print $0}' | sed 's/^ *//' Is there a better more efficient way to find the lines in one file... (5 Replies)
Discussion started by: raptor25
5 Replies

5. Shell Programming and Scripting

awk '{print $ from file1.txt}'

Hi All, I have a file1.txt where the index of the columns are placed. I want to get the columns from file2.txt corresponding to these index numbers. I was usually using awk '{print $5, $6, $2, $3, ...}' file2.txt > output.txt However, this list is very long. So, i want to read the... (4 Replies)
Discussion started by: senayasma
4 Replies

6. Shell Programming and Scripting

awk append fileA.txt to growing file B.txt

This is appending a column. My question is fairly simple. I have a program generating data in a form like so: 1 20 2 22 3 23 4 12 5 43 For ever iteration I'm generating this data. I have the basic idea with cut -f 2 fileA.txt | paste -d >> FileB.txt ???? I want FileB.txt to grow, and... (4 Replies)
Discussion started by: theawknewbie
4 Replies

7. Shell Programming and Scripting

[Solved] delete line from file1 by reading from file2

Hi All, I have to arrange one of the text file by deleting specific lines. cat file1.txt 3595 3595 -0.00842773 -0.0085077 0.00368851 12815 12815 -0.00929239 0.00439785 0.0291697 3747 3747 -0.00974353 0.00228922 0.0225058 3574 3574 -0.00711399 -0.00315748 0.0141206 .... 12734... (7 Replies)
Discussion started by: senayasma
7 Replies

8. UNIX for Dummies Questions & Answers

if matching strings in file1 and file2, add column from file1 to file2

I have very limited coding skills but I'm wondering if someone could help me with this. There are many threads about matching strings in two files, but I have no idea how to add a column from one file to another based on a matching string. I'm looking to match column1 in file1 to the number... (3 Replies)
Discussion started by: pathunkathunk
3 Replies

9. Shell Programming and Scripting

Need to append the date | abcddate.txt to the first line of my txt file

I want to add/append the info in the following format to my.txt file. 20130702|abcd20130702.txt FN|SN|DOB I tried the below script but it throws me some exceptions. <#!/bin/sh dt = date '+%y%m%d'members; echo $dt+|+members+$dt; /usr/bin/awk -f BEGIN { FS="|"; OFS="|"; } { print... (6 Replies)
Discussion started by: harik1982
6 Replies

10. Shell Programming and Scripting

Desired output.txt for reading txt file using awk?

Dear all, I have a huge txt file (DATA.txt) with the following content . From this txt file, I want the following output using some shell script. Any help is greatly appreciated. Greetings, emily DATA.txt (snippet of the huge text file) 407202849... (2 Replies)
Discussion started by: emily
2 Replies
lang(5int)																lang(5int)

Name
       lang - language names

Description
       The  language  support databases used by are stored in the directory If either the language support databases are moved or you specify your
       own language support database, it is necessary to set the INTLINFO environment variable to the new location of these tables. The syntax	of
       this environment variable is identical to See the reference page for more information.

       Should  you  want to create your own database, use the reference  page and the Guide to Developing International Software as references for
       what information your database should contain.  After you create the database, you can specify it by using the international compiler,

       The following table defines the supplied settings of the LANG and LC_ environment variables.

       ---------------------------------------------------------------------
       Database      Language	Territory	 Codeset       Use
       ---------------------------------------------------------------------
       ENG_GB.MCS    English	United Kingdom	 DEC MCS       VT200 series
       FRE_FR.MCS    French	France
       GER_DE.MCS    German	Germany

       ENG_GB.8859   English	United Kingdom	 ISO Latin-1   VT300 series
       FRE_FR.8859   French	France
       GER_DE.8859   German	Germany

       ENG_GB.646    English	United Kingdom	 ISO 646       VT100 series
       FRE_FR.646    French	France
       GER_DE.646    German	Germany
       ---------------------------------------------------------------------

       In addition to the default collation definition for the GER_DE.nnn language, Digital provides a character  collation  table  that  collates
       information  using  the	German telephone directory ordering of data. The following example shows how to set the variable to use this table
       with the ISO Latin-1 codeset:
       LC_COLLATE = GER_DE.8859@P_TELEPHONE

See Also
       ic(1int), intro(3int), nl_langinfo(3int), setlocale(3int), environ(5int)
       Guide to Developing International Software

																	lang(5int)
All times are GMT -4. The time now is 11:10 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy