I don't understand what you mean by "above doesn't do anything that [code] wouldn't do". PLease explain.
awk version works: GNU Awk 3.1.3
awk version doesn't work: GNU Awk 3.1.7
Yes input files are identical
The command: prints from the 3rd character to the end of the 1st input line in file1 and prints from the 3rd character to the end of the remaining lines from file1 into file2, while the command:
prints from the 3rd character to the end of every input line from file1 into file2. In what way do you think the output produced by these two commands would be different?
I am facing some strange problem.
I know, there is only one record in a file 'test.txt' which starts with 'X'
I ensure that with following command,
awk /^X/ test.txt | wc -l
This gives me output = '1'.
Now I take out this record out of the file, as follows :
awk /^X/ test.txt >... (1 Reply)
I have a script with a find command using xargs to copy the files found to another directory. The find command is finding the appropriate file, but it's not copying. I've checked permissions, and those are all O.K., so I'm not sure what I'm missing. Any help is greatly appreciated.
This is... (2 Replies)
I've been trying to figure this out since last night, and I'm just stumped. The last time I did any shell scripting was 8 years ago on a Unix box, and it was never my strong suit. I'm on a Mac running Leopard now. Here's my dilemma - hopefully someone can point me in the right direction.
I'm... (10 Replies)
Hi!
Been working on a script and I've been having a problem. I've finally narrowed it down to this variable I'm setting:
servername=$(awk -v FS=\/ '{ print $7 } blah.txt | sed 's\/./-/g' | awk -v FS=\- '{print $1}')"
This will essentially pare down a line like this:
... (7 Replies)
I was trying to write a simple script which will read a text file and count the number of vowels in the file. My code is given below -
#!/bin/bash
file=$1
v=0
if
then
echo "$0 filename"
exit 1
fi
if
then
echo "$file not a file"
exit 2
fi
while read -n... (14 Replies)
Dear all,
I had script which used to work, but recently it is not working as expected.
I have command line in my shell script to choose the following format from the output_elog and perform some task afterwards on
As you see, I want all numbers in foramt following RED mark except for... (12 Replies)
Hi, I'm having trouble with a simple copy command in a script on HPUX.
I am trying to copy a file and append date & time.
The echo command prints out what I am expecting..
echo "Backing up $file to $file.$DATE.$FIXNUM" | tee -a $LOGFILE
+ echo 'Backing up... (4 Replies)
Hi Experts,
Need your kind help with gsub awk.
Below is my pattern:"exec=1_host_cnt=100_dup=4_NameTag=targetSrv_500.csv","'20171122112948"," 100"," 1"," 1"," 4","400","","",
" aac sample exec ""hostname=XXXXX commandline='timeout 10 openssl speed -multi 2 ; exit 0'"" ","-1","-1","1","... (6 Replies)
This is my ubuntu version:
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.4 LTS
Release: 16.04
Codename: xenial
$ /bin/awk -V | head -n1
bash: /bin/awk: No such file or directory
I have gotten a script that helps me to parse,... (14 Replies)
Discussion started by: delbroooks
14 Replies
LEARN ABOUT SUNOS
comm
comm(1) User Commands comm(1)NAME
comm - select or reject lines common to two files
SYNOPSIS
comm [-123] file1 file2
DESCRIPTION
The comm utility reads file1 and file2, which must be ordered in the current collating sequence, and produces three text columns as output:
lines only in file1; lines only in file2; and lines in both files.
If the input files were ordered according to the collating sequence of the current locale, the lines written will be in the collating
sequence of the original lines. If not, the results are unspecified.
OPTIONS
The following options are supported:
-1 Suppresses the output column of lines unique to file1.
-2 Suppresses the output column of lines unique to file2.
-3 Suppresses the output column of lines duplicated in file1 and file2.
OPERANDS
The following operands are supported:
file1 A path name of the first file to be compared. If file1 is -, the standard input is used.
file2 A path name of the second file to be compared. If file2 is -, the standard input is used.
USAGE
See largefile(5) for the description of the behavior of comm when encountering files greater than or equal to 2 Gbyte ( 2**31 bytes).
EXAMPLES
Example 1: Printing a list of utilities specified by files
If file1, file2, and file3 each contain a sorted list of utilities, the command
example% comm -23 file1 file2 | comm -23 - file3
prints a list of utilities in file1 not specified by either of the other files. The entry:
example% comm -12 file1 file2 | comm -12 - file3
prints a list of utilities specified by all three files. And the entry:
example% comm -12 file2 file3 | comm -23 -file1
prints a list of utilities specified by both file2 and file3, but not specified in file1.
ENVIRONMENT VARIABLES
See environ(5) for descriptions of the following environment variables that affect the execution of comm: LANG, LC_ALL, LC_COLLATE,
LC_CTYPE, LC_MESSAGES, and NLSPATH.
EXIT STATUS
The following exit values are returned:
0 All input files were successfully output as specified.
>0 An error occurred.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWesu |
+-----------------------------+-----------------------------+
|CSI |enabled |
+-----------------------------+-----------------------------+
|Interface Stability |Standard |
+-----------------------------+-----------------------------+
SEE ALSO cmp(1), diff(1), sort(1), uniq(1), attributes(5), environ(5), largefile(5), standards(5)SunOS 5.10 3 Mar 2004 comm(1)