10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi All,
I am using following script to name the file base of some values
#!/bin/sh
sourcefile=$1
awk '
BEGIN{ n = 1; name = "FILEFILE12" n ".txt"; }
{
if (substr($0,1,10) == "FILEFILE12")
{
close (name)
n++
a = substr($0,11,10);
b = substr($0,21,5);
name = b "_Src_" a ".txt"
}... (6 Replies)
Discussion started by: manish8484
6 Replies
2. Shell Programming and Scripting
I have a file which contains certain records about users. the row length is always fixed to 205 characters.
Now I want to read each record line from the file, substring some portion out of it and put into another file. But I have observed that my script is trimming the extra spaces I have used for... (4 Replies)
Discussion started by: Pramit
4 Replies
3. Shell Programming and Scripting
Hello all. I am a newb obviously and a bit stumped on this, so any help gratefully accepted.
The script is extracting metadata from individual mp3 files, then (hopefully will be) sorting them into newly-created subdirectories. I have filtered out the relevant metadata and have the album names... (8 Replies)
Discussion started by: spoovy
8 Replies
4. Shell Programming and Scripting
friends,
I have a script in solaris 10 SPARC system which is like this
date '+Time: %m/%d/%y %H:%M:%S'
echo " GDBRR GDLRR GDBWR GDLWR GDRRR GDRWR "
sar -b 10 10 |/usr/xpg4/bin/awk '!/Average/ && !/SunOS/ && !/bread/ {$1="";T=$2;T1=$3;T2=$5;T3=$6;T4=$8;T5=$9}{print(T"\t",... (1 Reply)
Discussion started by: achak01
1 Replies
5. Shell Programming and Scripting
I'm using this thread as an example, but can't seem to apply it to my situation.
I'm trying to strip the trailing slash (/) from an input argument. Here's a snippet of my command line input and the troublesome code:
$ script_name -s "../pathname/dir/"
snip 8< ...
while getopts :s:... (5 Replies)
Discussion started by: ricksj
5 Replies
6. UNIX for Advanced & Expert Users
Hi,
How can I remove the unwanted spaces in the line.
123456 789 ABC DEF. - I wanna remove the sapces in this line, I need the output 123456789ABCDEF.
Pls help me...... (3 Replies)
Discussion started by: sharif
3 Replies
7. Shell Programming and Scripting
I have a variable that calls in a string from txt file. Problem is the string comes with an abundance of white spaces trailing it. Is there any easy way to trim the tailing white spaces off at the end? Thanks in advance. (9 Replies)
Discussion started by: briskbaby
9 Replies
8. Solaris
Hi my lovely friends,
Im writing one pgm in which i trying to assign some values like
$var='Jun 6'
but if i do echo of this $var will trim the spaces expect one space.
$echo $var
$Jun 6
But if var='Jun 28', then this will works fine
$echo $var
$Jun 28
this is required to exctract... (2 Replies)
Discussion started by: Lokesha
2 Replies
9. Shell Programming and Scripting
Hi,
my var is:
PATH_LOG=/opt/WebSphere/CR Comune Roma.log
a filename which contains blank chars.
How can I call it from prompt ?
Ex:
ls $PATH_LOG or
cat $PATH_LOG
tks,
Carmen- (2 Replies)
Discussion started by: Carmen123
2 Replies
10. Shell Programming and Scripting
I am trying to strip all leading and trailing spaces of a shell variable using either awk or sed or any other utility, however unscuccessful and need your help.
echo $SH_VAR | command_line Syntax.
The SH_VAR contains embedded spaces which needs to be preserved. I need only for the leading and... (6 Replies)
Discussion started by: jerardfjay
6 Replies
textutil::trim(n) Text and string utilities, macro processing textutil::trim(n)
__________________________________________________________________________________________________________________________________________________
NAME
textutil::trim - Procedures to trim strings
SYNOPSIS
package require Tcl 8.2
package require textutil::trim ?0.7?
::textutil::trim::trim string ?regexp?
::textutil::trim::trimleft string ?regexp?
::textutil::trim::trimright string ?regexp?
::textutil::trim::trimPrefix string prefix
::textutil::trim::trimEmptyHeading string
_________________________________________________________________
DESCRIPTION
The package textutil::trim provides commands that trim strings using arbitrary regular expressions.
The complete set of procedures is described below.
::textutil::trim::trim string ?regexp?
Remove in string any leading and trailing substring according to the regular expression regexp and return the result as a new
string. This is done for all lines in the string, that is any substring between 2 newline chars, or between the beginning of the
string and a newline, or between a newline and the end of the string, or, if the string contain no newline, between the beginning
and the end of the string. The regular expression regexp defaults to "[ \t]+".
::textutil::trim::trimleft string ?regexp?
Remove in string any leading substring according to the regular expression regexp and return the result as a new string. This apply
on any line in the string, that is any substring between 2 newline chars, or between the beginning of the string and a newline, or
between a newline and the end of the string, or, if the string contain no newline, between the beginning and the end of the string.
The regular expression regexp defaults to "[ \t]+".
::textutil::trim::trimright string ?regexp?
Remove in string any trailing substring according to the regular expression regexp and return the result as a new string. This apply
on any line in the string, that is any substring between 2 newline chars, or between the beginning of the string and a newline, or
between a newline and the end of the string, or, if the string contain no newline, between the beginning and the end of the string.
The regular expression regexp defaults to "[ \t]+".
::textutil::trim::trimPrefix string prefix
Removes the prefix from the beginning of string and returns the result. The string is left unchanged if it doesn't have prefix at
its beginning.
::textutil::trim::trimEmptyHeading string
Looks for empty lines (including lines consisting of only whitespace) at the beginning of the string and removes it. The modified
string is returned as the result of the command.
BUGS, IDEAS, FEEDBACK
This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category textutil
of the Tcllib SF Trackers [http://sourceforge.net/tracker/?group_id=12883]. Please also report any ideas for enhancements you may have for
either package and/or documentation.
SEE ALSO
regexp(n), split(n), string(n)
KEYWORDS
prefix, regular expression, string, trimming
CATEGORY
Text processing
textutil 0.7 textutil::trim(n)