07-25-2003
Quote:
Originally posted by oombera
And is
$(echo ${#line})
really what you meant to do? If $line is 10 characters long, you're going to end up with the variable $10, which will give an error. Just use the one part to return the length of the line:
${#line}
In ksh, $(echo ${#line}) is close to `echo ${#line}` so the statement:
if [ $(echo ${#line}) -gt 157 ] ; then
is perfectly valid, although it's a bit like walking around the world to get across the street. I agree that a sensible approach might be:
if [ ${#line} -gt 157 ] ; then
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have a file containing a list of references and I want to run a script that will make the same action for each reference.
The input file changes every hour, it's why I want to use a script that can read in a file, record by record, and run a specific action for the reference readed.
Thanks... (1 Reply)
Discussion started by: dde
1 Replies
2. Shell Programming and Scripting
Hi,
I am trying to do two things in my script. I will really appreciate any help in this regards.
Is there a way to delete a last line from a pipe delimited flat file if the last line is blank. If the line is not blank then do nothing.....
Is there a way to count a word that are starting... (4 Replies)
Discussion started by: rkumar28
4 Replies
3. Shell Programming and Scripting
hi,
my input file is containg uid, eriMaster ,eriResign, ericontry, dept.
some of the uid are not having all info.
out put should include all info irrespctive of datas of input file
if any one data is missing, then it has to print Null or zero..then continue with the existing one.
here... (0 Replies)
Discussion started by: hegdeshashi
0 Replies
4. Shell Programming and Scripting
Hi People !!
I need your help.
I have a a txt file "example" with it datas.
11:35 10/12/2003 10.10.10.1 God.com 5 country Responsable of ASN
11:37 12/12/2003 10.10.10.1 FATHER.COM 5 country Responsable of ASN
11:40 14/12/2003 10.10.10.3 www.mother 6... (6 Replies)
Discussion started by: ras
6 Replies
5. UNIX for Dummies Questions & Answers
Hi All,
i have two excel sheets with same column name as below
col1 col2 col3
---- ---- -----
1 121 156
24 456 788
45 444 777
765 32 77
col1 col2 col3
---- ---- -----
24 456 ... (1 Reply)
Discussion started by: arunmanas
1 Replies
6. Shell Programming and Scripting
Hi,
I was trying to remove the blank from beginning of a line.
when I try:
sed 's/^ +//' filename
it does not work
but when I try
sed 's/^ *//' filename
it works
But I think the first command should have also replaced any line with one or more blanks.
Kindly help me in understanding... (5 Replies)
Discussion started by: babom
5 Replies
7. Shell Programming and Scripting
Hello All ,
1. I am trying to do a task where I need to remove Blank spaces from my file , I am usingawk '{$1=$1}{print}' file>file1Input :-
;05/12/1990 ;31/03/2014 ;
Output:-
;05/12/1990 ;31/03/2014 ;This command is not removing all spaces from... (6 Replies)
Discussion started by: himanshu sood
6 Replies
8. Shell Programming and Scripting
Hi All
Need Help
I have a file with the below format (ABC.TXT) :
®¿¿ABCDHEJJSJJ|XCBJSKK01|M|7348974982790
HDFLJDKJSKJ|KJALKSD02|M|7378439274898
KJHSAJKHHJJ|LJDSAJKK03|F|9898982039999
(cont......)
I need to write a script where it will check for : blank lines (between rows,before... (6 Replies)
Discussion started by: chatwithsaurav
6 Replies
9. Shell Programming and Scripting
I have some data like this:
4258092
TRXCODE a 19
CARDNBR a 10
PINFLAG a 6
FUISSUER a 12
PRODUCT a 24
STATE n 1
I want out put this format:
<?xml version="1.0" encoding="GB2312"?>
<convGrp>
<grpid>4258092</grpid>
<script>
<!]>
... (4 Replies)
Discussion started by: hhdzhu
4 Replies
10. Shell Programming and Scripting
I have a text file downloaded from the web, I want to count the unique words used in the file, and a person's speaking length during conversation by counting the words between the opening and closing quotation marks which differ from the standard ASCII code. Also I found out the file contains some... (2 Replies)
Discussion started by: yifangt
2 Replies
ECHO(1) FSF ECHO(1)
NAME
echo - display a line of text
SYNOPSIS
echo [OPTION]... [STRING]...
DESCRIPTION
NOTE: your shell may have its own version of echo which will supercede the version described here. Please refer to your shell's documenta-
tion for details about the options it supports.
Echo the STRING(s) to standard output.
-n do not output the trailing newline
-e enable interpretation of the backslash-escaped characters listed below
-E disable interpretation of those sequences in STRINGs
--help display this help and exit
--version
output version information and exit
Without -E, the following sequences are recognized and interpolated:
NNN the character whose ASCII code is NNN (octal)
\ backslash
a alert (BEL)
backspace
c suppress trailing newline
f form feed
new line
carriage return
horizontal tab
v vertical tab
AUTHOR
Written by FIXME unknown.
REPORTING BUGS
Report bugs to <bug-coreutils@gnu.org>.
COPYRIGHT
Copyright (C) 2002 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICU-
LAR PURPOSE.
SEE ALSO
The full documentation for echo is maintained as a Texinfo manual. If the info and echo programs are properly installed at your site, the
command
info echo
should give you access to the complete manual.
GNU coreutils 4.5.3 February 2003 ECHO(1)