Notice, that "^M" is a literal line break: in vi press "<CTRL>-<V>", then hit <ENTER> to enter it. You will notice that it is a single character rather than two chars.
To remove lines which contain any number of whitespace (Tabs and or blanks):
Enter a literal TAB-char (press <TAB>) and a blank, i just wrote it that way to make it easier to read.
Finally, to find out which unprintable character is bothering you: open the file in vi, enter command mode (press ":") and enter "set list". You will see all the unprintable characters as control codes now (tab characters are represented by "^I" for instance, etc.). Only a blank is now printed as blank char. Enter command mode again and use "set nolist" to switch that off again.
hello.
How to remove first word from line. The line may or may not start with blank.
NEW_PARAM1=$(magic-command " -t --protocol=TCP -P 12345-u root -h localhost ")
NEW_PARAM2=$(magic-command "-t --protocol=TCP -P 12345 -u root -h localhost ")
I want NEW_PARAM1 equal to NEW_PARAM2 equal ... (2 Replies)
Hello.
I have a config file (/etc/my_config_file) which may content :
#
# port for HTTP (descriptions, SOAP, media transfer) traffic
port=8200
# network interfaces to serve, comma delimited
network_interface=eth0
# set this to the directory you want scanned.
# * if have multiple... (6 Replies)
I have below file. I want to remove space at begining of every line and then after also remove blank line from file.
I use below code for each operation.
sed -e 's/^*//' < check.txt > check1.txt
sed '/^\s*$/d' < check1.txt > check2.txt
above code not remove all the space... (12 Replies)
Hi All,
I am creating a text file using perl. The first record I am writing as "$line" and all the other as "\n$line". At the end the file is having N number of lines. I am using this file for MLOAD (Teradata), which is reading N+1 lines in the file and failing.I am not able to find new line... (2 Replies)
Is there a way to delete a line containing something and the blank line at the same time?
If you do this it leaves a blank line behind.
sed '/yum/d' .bash_historyI know this works but I would think there would be a way to do it with one command
sed '/yum/d' .bash_history | sed '/^$/d'In... (2 Replies)
I use the following as part of a script to correct for a faulty hostname file.
# get the domain name
read -r thehostname < /etc/hostname
dom="$(echo $thehostname | cut -d'.' -f2)"
numchar=${#dom}
if
then
echo "It appears as though the hostname is not correctly set."
echo "Hostname has... (5 Replies)
I've shell script where i used the below command to take the line which contains patterns.
sed -n "/$year 05:/,/$year 17:/p" trace.log | grep -f patterns.txt > output.log
This was working fine for long time, but now a days this script is not working with and throwing error like
sed:... (8 Replies)
I have a number of files (arranged in directories) which have last line blank,
I am trying to synchronize my code with other env and due to this blank lines, all files error out as different although only difference is that of balnk line at end of file.
Is there a way I can recursively... (2 Replies)
I am trying to use wget and sed to extract a text based weather forecast for the Greater Victoria area only, this is one paragraph of many in a web page. I have tried /^$/ but that does not seem to work. So far I get mostly what I want with this:
wget -qO -... (2 Replies)
Hi,
I want to write a sed script which from
batiato:
batiato/giubbe:
pip_b.2.txt
pip_b.3.txt
pip_b.3mmm.txt
bennato:
bennato/peterpan:
123.txt
consoli:
pip_a.12.txt
daniele: (2 Replies)