Hi Rudic,
Actually the input file[input.txt] had tags other than <test></test1>
ex :
I used "
So got only the required tags in the output, but I am not able to count the characters between tags as some tags have newline in between and some tags don't have. I am a newbie to Shell. Kindly, please help
Expected output is :
Moderator's Comments:
Please use CODE tags as required by forum rules!
Last edited by venkidhadha; 01-31-2017 at 10:46 AM..
Reason: Added code
HI,
I want to know can multiple pattern be given inside a sed statement..
Input:
aa_bb_cc.Mar-22-2007
cc_dd_ee.Mar-21-2007
aa_1002985_952.xml
aa_bb_032207.txt
aa_bb_cc_10002878.dat
Output:
aa_bb_cc
cc_dd_ee
aa.xml
aa_bb.txt
aa_bb_cc.dat (6 Replies)
Hi Gurus,
I have a file say for ex. file1 which has 3500 lines in it which are different account numbers and another file (file2) which has 230000 lines in it. I want to read all the lines in file1 and delete all those lines from file2 which has that same pattern as in file1. I am not quite... (4 Replies)
tar has the -T operand for reading patterns from a file.
Is there any way to read patterns from stdin, without creating a temp file? I would like to avoid iterating over the archive repeatedly (e.g. with a loop or xargs) as this is a large archive and we're only extracting a small number of... (2 Replies)
Hey, guys!
Trying to research this is such a pain since the read command itself is a common word. Try searching "unix OR linux read command examples" or using the command substitution keyword. :eek:
So, I wanted to use a command statement similar to the following.
This is kinda taken... (2 Replies)
hello
i have two files
temp.txt
and temp_unique.text
the second file consists the unique fields from the temp.txt file
the strings stored are in the following form
4,4
17,12
15,65
4,4
14,41
15,65
65,89
1254,1298i'm able to run the following script to get the total count of a... (3 Replies)
First, I apologize for my 'noobness' with Linux and the shell. I'm running Ubuntu with zsh as my shell.
What I'd like to be able to do is clean up a messy Downloads folder by moving categories of files to different directories with something like:
mv dir/$vids dest
mv dir/$music dest
mv... (5 Replies)
Hi,
I am facing issues with the below:
I have a lookup file say lookup.lkp.This lookup.lkp file contains strings delimited by comma(,).
Now i want to read this command from file and execute it.
So my code below is :
Contents in the lookup.lkp file is :
c_e,m,a,`cd $BOX | ls cef_*|tail... (7 Replies)
Hi,
I am trying to extract some patterns from a line. The input file is space delimited and i could not use column to get value after "IN" or "OUT" patterns as there could be multiple white spaces before the next digits that i need to print in the output file . I need to print 3 patterns in a... (3 Replies)
Hello.
For a given folder, I want to select any files find $PATH1 -f \( -name "*" but omit any files like pattern name ! -iname "*.jpg" ! -iname "*.xsession*" ..... \) and also omit any subfolder like pattern name -type d \( -name "/etc/gconf/gconf.*" -o -name "*cache*" -o -name "*Cache*" -o... (2 Replies)
Hi -
i have one file with content as below.
***** BEGIN 123 *****
BASH is awesome
***** END *****
***** BEGIN 365 *****
KSH is awesome
***** END *****
***** BEGIN 157 *****
KSH is awesome
***** END *****
***** BEGIN 7123 *****
C is awesome
***** END *****
I am trying to find all... (4 Replies)
Discussion started by: reldb
4 Replies
LEARN ABOUT HPUX
wc
wc(1) General Commands Manual wc(1)NAME
wc - count words, lines, and bytes or characters in a file
SYNOPSIS
[file]...
DESCRIPTION
The command counts lines, words, and bytes or characters in the named files, or in the standard input if no file names are specified. It
also keeps a total count for all named files.
A word is a string of characters delimited by spaces, tabs, or newlines.
Options
recognizes the following options:
Report the number of bytes in each input file.
Report the number of newline characters in each input file.
Report the number of characters in each input file.
Report the number of words in each input file.
The and options are mutually exclusive. Otherwise, the and or options can be used in any combination to specify that a subset of lines,
words, and bytes or characters are to be reported.
When any option is specified, reports only the information requested. If no option is specified, the default output is
When a file is specified on the command line, its name is printed along with the counts.
Standard Output
By default, the standard output contains an entry for each input file in the form:
newlines words bytes file
If the option is specified, the number of characters replaces the bytes field in this format.
If any option is specified, the fields for the unspecified options are omitted.
If no file operand is specified, neither the file name nor the preceding blank character is written.
If more than one file operand is specified, an additional line is written at the end of the output, of the same format as the other lines,
except that the word (in the POSIX locale) is written instead of a file name and the total of each column is written as appropriate.
Under UNIX Standard environment, a word is a string of characters delimited by spaces, tabs, newline, carriage-return, vertical tab, or
form-feed.
RETURN VALUE
exits with one of the following values:
Successful completion.
An error occurred.
EXTERNAL INFLUENCES
For information about the UNIX Standard environment, see standards(5).
Environment Variables
determines the range of graphics and space characters, and the interpretation of text as single- and/or multibyte characters.
determines the language in which messages are displayed.
If or is not specified in the environment or is null, they default to the value of
If is not specified or is null, it defaults to (see lang(5)).
If any internationalization variable contains an invalid setting, they all default to See environ(5).
International Code Set Support
Single- and multibyte character code sets are supported. with a newline character, the count will be off by one.
WARNINGS
The command counts the number of newlines to determine the line count. If a text file has a final line that is not terminated with a new-
line character, the count will be off by one.
EXAMPLES
Print the number of words and characters in
The following is printed when the above command is executed:
where words is the number of words and chars is the number of characters in
SEE ALSO standards(5).
STANDARDS CONFORMANCE wc(1)