10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello, I am a beginner in Unix and I'm learning how to program by myself.
I am trying to create a shell script that is able to take in either a file containing input or by standard input, and replacing every whitespace with a new line break.
so basically the input would be
This <SP> is... (10 Replies)
Discussion started by: fozilla
10 Replies
2. UNIX for Dummies Questions & Answers
I searched and found "echo -n" and "printf" are solution for this, but they are not
here:
$ echo "hello" >> test
$ cat test
hello
$ echo -n "world" >> test
$ cat test
hello
world
$ echo -n " seriously?" >> test
$ cat test
hello
world seriously?
This is not successful... (15 Replies)
Discussion started by: stunn3r
15 Replies
3. UNIX for Dummies Questions & Answers
Hi all,
I have this:
begin data;
dimensions nind=168 nloci=6;
info
BDT001.4 ( 1 , 1 ) ( 1 , 12 )
BDT003.4 ( 1 , 1 ) ( 12 , 12 )
BDT007.4 ( 1 , 1 ) ( 12 , 12 )
BDT009.4 ( 1 , 32 ) ( 12 , 22 )
etc, etc
And need this:
begin data;
dimensions nind=168 nloci=6;
info
... (2 Replies)
Discussion started by: MDeBiasse
2 Replies
4. Shell Programming and Scripting
I cannot seem to get this to work..
I have a file which has about 100 lines, and there is no end of line (line break \n) at the end of each line, and this is causing problem when i paste them into an application.
the file looks like this
this is a test
that is a test
balblblablblhblbha... (1 Reply)
Discussion started by: fedora
1 Replies
5. Shell Programming and Scripting
...when the lines use both a colon and commas to separate the parts you want read as information.
The first version of this script used cut and other non-Bash-builtins, frequently, which made it nice and zippy with little more than average processor load in GNOME Terminal but, predictably, slow... (2 Replies)
Discussion started by: SilversleevesX
2 Replies
6. Shell Programming and Scripting
FOLKS ,
i have a text file that is generated automatically of an another korn shell script, i want to bring in the fifth line of the text file in to my korn shell script and look for a particular word in the line . Can you all share some thoughts on this one.
thanks...
Venu (3 Replies)
Discussion started by: venu
3 Replies
7. Shell Programming and Scripting
Okay, I am trying to make a bash script to get a certain domains IP address (my home ip). My home is on a DHCP lease from my ISP, so I cannot always trust the IP address to remain constant.
This is what I have so far for it:
alias ip-home="ping -c 1 example.com | grep 'PING' | cut -d'(' -f2 |... (5 Replies)
Discussion started by: tnanek
5 Replies
8. Shell Programming and Scripting
Hi
Following is an example line.
echo "192.22.22.22 \"33dffwef\" 200 300 dsdsd" | sed "s:\(\ *\ \):\1:"
I want it's output to be
200
However this is not the case. Can you tell me how to do it? I don't want to use AWK for this. Secondly, how can i fetch just 300? Should I use "\2"... (3 Replies)
Discussion started by: shahanali
3 Replies
9. Shell Programming and Scripting
Hi Friends,
Can any one help with this issue:
How to trim spaces for each line at the end,
Like I have a file in this format.
EMP1 SMITH 46373 5 STREET HOWARD 74636
EMP2 JONES 5454 { these are spaces ........}
EMP3 SMITH 46373 5 STREET HOWARD 74636
EMP4 JON 2554 { these are... (1 Reply)
Discussion started by: sbasetty
1 Replies
10. Shell Programming and Scripting
I'm trying to find a command that will trim the white space off a string.
e.g.
$str = " stuf "
$str = trim ( $str )
echo $str // ouput would just be stuf
Thanks, Mark (4 Replies)
Discussion started by: msteudel
4 Replies
Ns_String(3aolserver) AOLserver Library Procedures Ns_String(3aolserver)
__________________________________________________________________________________________________________________________________________________
NAME
Ns_Match, Ns_NextWord, Ns_StrCaseFind, Ns_StrCopy, Ns_StrDup, Ns_StrNStr, Ns_StrToLower, Ns_StrToUpper, Ns_StrTrim, Ns_StrTrimLeft, Ns_Str-
TrimRight, Ns_StringPrint, ns_strcopy, ns_strdup - library procedures
SYNOPSIS
#include "ns.h"
char *
Ns_Match(char *a, char *b)
char *
Ns_NextWord(char *line)
char *
Ns_StrCaseFind(char *s1, char *s2)
char *
Ns_StrCopy(char *str)
ns_strcopy(char *str)
char *
Ns_StrDup(char *str)
ns_strdup(char *str)
char *
Ns_StrNStr(char *pattern, char *expression)
char *
Ns_StrToLower(char *string)
char *
Ns_StrToUpper(char *string)
char *
Ns_StrTrim(char *string)
char *
Ns_StrTrimLeft(char *string)
char *
Ns_StrTrimRight(char *string)
void
Ns_StringPrint(char *string)
_________________________________________________________________
DESCRIPTION
Ns_Match(a, b)
Compare the beginnings of two strings, case insensitively. The comparison stops when the end of the shorter string is reached.
Return NULL if no match, b if match.
Ns_NextWord(line)
Return a pointer to first character of the next word in a string; words are separated by white space. The returned pointer points
into the original string. For example, Ns_NextWord("abc def") returns a pointer to the 'd' in that string.
Ns_StrCaseFind(s1, s2)
Locate the first occurrence of substring s2 within string s1 in a case-insensitive manner. The terminating ' ' characters are not
compared. Returns a pointer that points into s1. Uses strstr(3) to do its work.
Ns_StrCopy(str)
ns_strcopy(str)
Copy a string or NULL value using Ns_Malloc. The Ns_StrCopy function is identical to the Ns_StrDup function but allows for the
string parameter to be NULL, in which case Ns_StrCopy does nothing and returns NULL.
Ns_StrDup(str)
ns_strdup(str)
Copy a string using Ns_Malloc. The Ns_StrDup function calls Ns_Malloc to allocate enough memory to make a copy of the given string.
Ns_StrNStr(pattern, expression)
Search through pattern for expression, case insensitively. Return a pointer that points to where the match begins within pattern, or
NULL if expression is not contained in pattern.
Ns_StrToLower(string)
Convert string to lowercase. Returns pointer to original string. Original string will be modified.
Ns_StrToUpper(string)
Convert string to uppercase. Returns pointer to original string. Original string will be modified.
Ns_StrTrim(string)
Trim leading and trailing white space from string. A pointer to the trimmed string will be returned, which will be in the original
string. Do not lose your original pointer to the string if you later need to free it.
Ns_StrTrimLeft(string)
Trim leading white space from string. A pointer to the trimmed string will be returned, which will be in the original string. Do not
lose your original pointer to the string if you later need to free it.
Ns_StrTrimRight(string)
Trim trailing white space from string. The original string pointer will be returned, but the string will have been modified: a ' 's
will have been placed right after the last non-whitespace character of the string.
Ns_StringPrint(string)
Print a string to stdout.
SEE ALSO
nsd(1), info(n)
KEYWORDS
AOLserver 4.0 Ns_String(3aolserver)