I've come across a problem that I can't solve. Its as simple as it can get.
I want to substitute spaces in a string with dots e.g.
I've tried examples from the web that should work but they don't.
A period seems to become a space for some reason :s
One of the examples I used is this one:
zone being a string and replacing the "." with a "_" results in the spaces being substituted with underscores (which is the result I need) but it only works with underscores and not with periods as in the example. Instead of dots I get spaces.
Anyone know why this is and how to fix it?
Last edited by Scrutinizer; 06-27-2013 at 01:29 PM..
Reason: code tags
found the problem...
in the beginning of my script I issued IFS to split on periods and I don't know why (I know you guys do ) but I had to set IFS to " " i.e. a space in order to make it work
This User Gave Thanks to basherlemon For This Post:
This is why you should always post your script, not just the tiny bit of it you think's the problem. Sometimes it's taken pages of yelling to discover they changed IFS somewhere
Whenever I must change IFS, this is what I do:
If I must change it for a whole block I do this:
Last edited by Corona688; 01-17-2013 at 04:23 PM..
Hi,
I have a number of large files (up to 4GB) that I wish to split in 96 parts e.g. one for each 15 minutes of the day. The split can be random so I am using
split -b 42M filename.csv
I want to name each of the resultant files as a distinct 15 minute period of the day e.g. ... (10 Replies)
How to get the file extension having multiple periods
suppose i have a file samplewprk.txt.dat
I need to retrieve txt.dat from the file.
I worked all iam getting is either txt or pyd
Could anyone help me in providing the solution?
Thanks,
in advance (3 Replies)
Hello,
I have a script which configures a system,
the configuration is currently manual and error prone.
I am writting a script, which currently uses hard-coded values.
I don't know how to take an IP, e.g. 123.456.789.111, and backslash the periods, so I can pass it to an
`exec perl... (0 Replies)
Hello All,
I am trying to remove all tabspaces and all blankspaces from my file using sed & awk, but not getting proper code. Please help me out.
My file is like this (<b> means one blank space, <t> means one tab space)-
$ cat file
NARESH<b><b><b>KUMAR<t><t>PRADHAN... (3 Replies)
Hi,
I have a problem where I need to append few spaces(say 10 spaces) for each line in a file whose length is say(100 chars) and others leave as it is.
I tried to find the length of each line and then if the length is say 100 chars then tried to write those lines into another file and use a sed... (17 Replies)
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)
please refer the following 2 statements...
1)
int i=1,j;
j= i++ + i++;
2) int i=1,j;
j=++i + ++i;
how j becomes 2 and 6 for the above 2 statements
respectively ???
( i guessed j must be 3 and 5)
Somebody define the exact reason please.. :(
... (2 Replies)