Echoing a variable or other expression without quoting it will remove any leading and trailing whitespace.
Usually echo `backticks` is mainly seen in really horrible newbie code, but the whitespace normalization is a useful and in this case desired side effect which makes this a legitimate use IMHO.
Note the use of redirection to avoid the Useless Use of Cat.
Are you sure about the AIX spacing issue, though? The situation where you usually see this is when you use wc -l file instead of wc -l <file (but then of course you get the file name also).
Hello, I'm searching for a proper way to let the kernel space ISR(implemented in a kernel module) wake up a user space thread on a hardware interrupt.
Except for sending a real-time signal, is it possible to use a semaphore?
I've searched it on google, but it seems impossible to share a... (0 Replies)
Good afternoon! Im new at scripting and Im trying to write a script to
calculate total space, total used space and total free space in filesystem names matching a keyword (in this one we will use keyword virginia). Please dont be mean or harsh, like I said Im new and trying my best. Scripting... (4 Replies)
Hi,
i have done a blunder here, i increased the swap space on Xen5.6 server machine using below steps :-
1056 dd if=/dev/zero of=/root/myswapfile bs=1M count=1024
1057 ls -l /root/myswapfile
1058 chmod 600 /root/myswapfile
1059 mkswap /root/myswapfile
1060 swapon /root/myswapfile
... (1 Reply)
hi guys, me again ;)
i recently opened a thread about physical to zone migration.
My zone is mounted over a "bigger" LUN (500GB) and step is now to move the old files, from the physical server, to my zone.
We are talking about 22mio of files.
i used rsync to do that and every time at... (8 Replies)
Hi,
I run Fedora 17.
I created a physical volume of 30GB on a disk with 60GB of space so there is 30GB of free space. On the physical volume, I created my volume group and logical volumes. I assigned all the space in the physical volume to my volume group. I need to add the 30GB of free space... (1 Reply)
Hi,
I have a space delimited text file but I only want to change the first space to a tab and keep the rest of the spaces intact. How do I go about doing that? Thanks! (3 Replies)
May I know the difference between space in keyboard and ] in regular expression
I entered the following
find . -type f -print | xargs grep -n 'dt=' | cut -d":" -f3 | sed 's/^ *dt=/dt=/g'
After "^" there is a space.
and the result is...
dt=`date +%Y%m%d%H%M%S`
dt=`date +%Y%m%d`... (6 Replies)
I created a awk state to calculate the number of success however when the query runs it has a leading zero. Any ideas on how to remove the leading zero from the calculation?
Here is my query:
cat myfile.log | grep | awk '{print $2,$3,$7,$11,$15,$19,$23,$27,$31,$35($19/$15*100)}'
02:00:00... (1 Reply)
Hello all
posting here after scanning the net and tried most of the things offered
still no solution that worked
when I do :
$ df -h
Filesystem Size Used Avail Use% Mounted on
footmpfs 7.9G 60K 7.9G 1% /dev
tmpfs 7.9G 0 7.9G 0% /dev/shm
/dev/da1 ... (3 Replies)
hi,
I'm trying to calculate IP addresses and their respective calls to our apache Server. The standard format of the input is
HOST IP DATE/TIME - - "GET/POST reuest" "User Agent"
HOST IP DATE/TIME - - "GET/POST reuest" "User Agent"
HOST IP DATE/TIME - - "GET/POST reuest" "User Agent"
HOST... (2 Replies)
Discussion started by: busyboy
2 Replies
LEARN ABOUT DEBIAN
strltrim
STRLTRIM(3pub) C Programmer's Manual STRLTRIM(3pub)NAME
strltrim - remove leading whitespace from string
SYNOPSIS
#include <publib.h>
char *strltrim(char *s);
DESCRIPTION
strltrim removes all leading whitespace characters from the beginning of a string, by moving everything starting from the first non-white-
space character to the beginning of the string. As whitespace is counted everything for which isspace(3) returns true.
RETURN VALUE
strltrim returns its argument.
EXAMPLE
To remove all indentation from all lines in a program, you might do the following:
#include <publib.h>
int main(void) {
char line[512];
while (fgets(line, sizeof(line), stdio) != NULL) {
strltrim(line);
printf("%s", line);
}
return 0;
}
SEE ALSO publib(3), strrtrim(3), strtrim(3), isspace(3)AUTHOR
Lars Wirzenius (lars.wirzenius@helsinki.fi)
Publib C Programmer's Manual STRLTRIM(3pub)