You probably don't want to use cut, it's fast but inflexible (to the best of my knowledge you cant have a variable delimiter). try the following approach:
ooops, re-read your question, the following puts a tab on the end of the line also
This User Gave Thanks to Skrynesaver For This Post:
Hi All,
How can i use the cut option to only output the number of rows, which is 2 is this case ? Pls note that the number of digit before the delimiter ":" is always varying.
$ grep -n uuu xxx
2:** xxx yyy gg 44 tt uuu 2007
$ (2 Replies)
Is there a way to use a word as a delimiter with cut? Or is there a way to use sed or awk with a word as a delimiter? I don't care which program I use for a delimiter I just want to use a word as a delimiter. (2 Replies)
I need to cut or otherwise get the 4th and 5th position output of
for i in `date +%H` ; do vnstat --dumpdb | grep "h;$i" ; done
example output is:
h;13;1310318701;443;93
I only need ";443;93" from any given run of "for i in `date +%H` ; do vnstat --dumpdb | grep "h;$i" ; done"
Thanks... (3 Replies)
HI,
I have a file like below
"103865","103835","Zming","","Zhu","103965","Sunnyvale","US",
"116228","116227","Morlla","","Kowalski","113228","Paese "(Treviso)""IT"
I want to validate the 7th column which is below.
"Sunnyvale"
"Paese
In the above 7th column Paese is not ended with... (9 Replies)
hi all,
suppose a string:
abc/def/ghi/jkl/mn.txt
and i want to get the file name without the path.
however, different files have different paths, therefore the number of delimiter is uncertain.
thanks so much! (3 Replies)
i have list of names in a text file and I wanted to delete the commas en every line.
for example: inside the text is a list of names in it with commas after each line. I wanted to delete these commas. which command must I execute for this?
unix,
dale,
shawn,
aaron, (4 Replies)
Hi,
I have a No Delimiter variable length text file with following schema -
Column Name Data length
Firstname 5
Lastname 5
age 3
phoneno1 10
phoneno2 10
phoneno3 10
sample data - ... (16 Replies)
Hi All-
We have a file data as below with delimiter as |#|
10|#|20|#|ABC
13|#|23|#|PBC
If I want to cut the 2nd field out of this, below command is not working as multiple pipe is causing an issue , it seems
cut -f2 -d"|#|" <file_name>
can you please help to provide the correct command... (7 Replies)
Hi,
Extremely new to Perl scripting, but need a quick fix without using TEXT::CSV
I need to read in a file, pass any delimiter as an argument, and convert it to bar delimited on the output. In addition, enclose fields within double quotes in case of any embedded delimiters.
Any help would... (2 Replies)
Perl::Critic::Policy::InputOutput::ProhibitExplicitStdinUser Contributed Perl DocumentaPerl::Critic::Policy::InputOutput::ProhibitExplicitStdin(3)NAME
Perl::Critic::Policy::InputOutput::ProhibitExplicitStdin - Use "<>" or "<ARGV>" or a prompting module instead of "<STDIN>".
AFFILIATION
This Policy is part of the core Perl::Critic distribution.
DESCRIPTION
Perl has a useful magic filehandle called *ARGV that checks the command line and if there are any arguments, opens and reads those as
files. If there are no arguments, *ARGV behaves like *STDIN instead. This behavior is almost always what you want if you want to create a
program that reads from "STDIN". This is often written in one of the following two equivalent forms:
while (<ARGV>) {
# ... do something with each input line ...
}
# or, equivalently:
while (<>) {
# ... do something with each input line ...
}
If you want to prompt for user input, try special purpose modules like IO::Prompt.
CONFIGURATION
This Policy is not configurable except for the standard options.
CAVEATS
Due to a bug in the current version of PPI (v1.119_03) and earlier, the readline operator is often misinterpreted as less-than and greater-
than operators after a comma. Therefore, this policy misses important cases like
my $content = join '', <STDIN>;
because it interprets that line as the nonsensical statement:
my $content = join '', < STDIN >;
When that PPI bug is fixed, this policy should start catching those violations automatically.
CREDITS
Initial development of this policy was supported by a grant from the Perl Foundation.
AUTHOR
Chris Dolan <cdolan@cpan.org>
COPYRIGHT
Copyright (c) 2007-2011 Chris Dolan. Many rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of this license
can be found in the LICENSE file included with this module
perl v5.16.3 2014-06-09 Perl::Critic::Policy::InputOutput::ProhibitExplicitStdin(3)