Hello, I am new to scripting and need some help. In looking at other posts on this forum, I came up with the following logic. I cannot figure out why I am getting names of files of the current directory in my echo output.
Scenario: message file has a line containing the version. Version.txt... (2 Replies)
Hello,
I am a total linux newbie and I can't seem to find a solution to this little problem.
I have two text files with a huge list of URLS. Let's call them file1.txt and file2.txt
What I want to do is grab an URL from file2.txt, search file1.txt for the URL and if found, delete it from... (11 Replies)
Hi,
I have two files, in which the second file has exactly the same contents of the first file with some additional records. Now, if I want to remove those matching lines from file2 and print only the extra contents which the first file does not have, I could use the below unsophisticated... (3 Replies)
Have two files and want to compare the content of file1 with file2. When matched remove the line.
awk 'NR==FNR {b; next} !(b in $0)' file1 file2file1
1. if match
2. removefile2
1. this line has to be removed if match
2. this line has a match, remove
3. this line has no match, no removingThe... (3 Replies)
my files are as follows
fileA sepearated by tab /t
00 lieferungen
00 attractiop
01 done
02 forness
03 rasp
04 alwaysisng
04 funny
05 done1
fileB
funnymou120112
funnymou234470
mou3raspnhdhv
rddfgmoudone1438748
so all those record which are greater than 3 and which are not... (4 Replies)
Hi Friends Need your expertise.
Command to check the difference and compare 2 files and remove lines . example
File1 is master copy and File2 is a slave copy . whenever i change, add or delete a record in File1 it should update the same in slave copy . Can you guide me how can i accomplish... (3 Replies)
I have two files, a keepout.txt and a database.csv. They're unsorted, but could be sorted.
keepout:
user1
buser3
anuser19
notheruser27
database:
user1,2343,"information about",field,blah,34
user2,4231,"mo info",etc,stuff,43
notheruser27,4344,"hiya",thing,more thing,423... (4 Replies)
I have 2 files with exactly the same information (with header and separated by ";") and what I would like to do is print (for both files!) the columns that are different and also print the "key" column that is equal in the 2 files For example, if
File1:
key1;aaa;bbb;ccc
key2;ddd;eee;fff... (4 Replies)
I have two files
I need to compare these two files and take the lines that are common in both the files and consider the line present in second file for my further processing
I have used "Awk" along with "FNR and NR" but that is not working
gawk -F= '
> FNR==NR {a=$1; next};
> ... (2 Replies)
Discussion started by: Priya Amaresh
2 Replies
LEARN ABOUT SUSE
tempfile
TEMPFILE(1) General Commands Manual TEMPFILE(1)NAME
tempfile - create a temporary file in a safe manner
SYNOPSIS
tempfile [-d DIR] [-p STRING] [-s STRING] [-m MODE] [-n FILE] [--directory=DIR] [--prefix=STRING] [--suffix=STRING] [--mode=MODE]
[--name=FILE] [--help] [--version]
DESCRIPTION
tempfile creates a temporary file in a safe manner. It uses tempnam(3) to choose the name and opens it with O_RDWR | O_CREAT | O_EXCL.
The filename is printed on standard output. See tempnam(3) for the actual steps involved in directory selection.
The directory in which to create the file might be searched for in this order (but refer to tempnam(3) for authoritative answers):
a) In case the environment variable TMPDIR exists and contains the name of an appropriate directory, that is used.
b) Otherwise, if the --directory argument is specified and appropriate, it is used.
c) Otherwise, P_tmpdir (as defined in <stdio.h>) is used when appropriate.
d) Finally an implementation-defined directory (/tmp) may be used.
OPTIONS -d, --directory DIR
Place the file in DIR.
-m, --mode MODE
Open the file with MODE instead of 0600.
-n, --name FILE
Use FILE for the name instead of tempnam(3). The options -d, -p, and -s are ignored if this option is given.
-p, --prefix STRING
Use up to five letters of STRING to generate the name.
-s, --suffix STRING
Generate the file with STRING as the suffix.
--help Print a usage message on standard output and exit successfully.
--version
Print version information on standard output and exit successfully.
RETURN VALUES
An exit status of 0 means the temporary file was created successfully. Any other exit status indicates an error.
BUGS
Exclusive creation is not guaranteed when creating files on NFS partitions. tempfile cannot make temporary directories. tempfile is dep-
recated; you should use mktemp(1) instead.
EXAMPLE
#!/bin/sh
#[...]
t=$(tempfile) || exit
trap "rm -f -- '$t'" EXIT
#[...]
rm -f -- "$t"
trap - EXIT
exit
SEE ALSO tempnam(3), mktemp(1)Debian 27 Jun 2012 TEMPFILE(1)