If the first line of input happens to start with a plus sign, all of the scripts provided so far will skip that line. If the input file could ever have this condition, the following alternative script should work:
With the sample input file hanson44 provided, the output placed into file2 will be:
If the contents of file1 is:
the output placed into file2 will be:
As always, if you're going to run this on a Solaris/SunOS system, use /usr/xpg4/bin/awk, /usr/xpg6/bin/awk, or nawk instead of awk.
Hi
Is there any command or a trick that can take me to a specifed line number in unix .
Suppose i have a file with 2000 lines and i would like to go to line number 1899 and then print out the contents of the line.
regards
Hrishy (2 Replies)
Hi ,
I use read command to get the input text, When i try to get the line starting with spaces or ending with spaces it automatically truncates the spaces and displays the remaining content.
Code i tried (UserInput.sh):
#!/bin/bash
echo -n "Enter some text > "
read text
echo "You... (3 Replies)
Whenever I type the @ sign like for example when using a proxy ftp server, The system forces the cursor to jump to a new line. I know it has something to do with the terminal settings.
How can I get this to stop and more importantly, how can I modify my profile to set this up whenever I login?
... (3 Replies)
echo "dddd$dddd"|sed 's/$//' will return dddd
echo "dddd$ddd"|tr -d '$' will return dddd
I need to replace it with any other character or just live a blank space instead
Thank you! (8 Replies)
Hi,
Let's I have the following strings (md5):
07177edf8261d28c6a003e583fcbe38c
0717c0037b3a20fc0f0998e673f228d5
0717d611a5d24374628b98e17fd00977,0717d611a5d24374628b98e17fd00977
07189a18afdae558bb5aadfe602e4a91
0719e97d481c239667f38a3e166bed74
071af3225fe50a1fdbb42c43aac313cc... (4 Replies)
I have a file with different directories in it. I would need to move one line within the file to the end of the list. Also not there could be blank line in the middle of it. Example
/vol/fs1
/vol/fs2
/vol/fs3
/vol/fs4
/vol/fs5
/vol/fs6
/vol/fs7
So I would need /vol/fs2... (3 Replies)
example:
comment Now_TB.table column errac is for error messages
1 - first
2 - second
3 -third ;
in this example I need to be able to grab the comment as first word and ; as the last word and it might span a few lines. I need it to be put all in one line without line breaks so I can... (4 Replies)
Hello.
Using a bash script , I have a variable name for the file I want to modify
FILE_TO_EDIT="/etc/my_config_file"And I have a variable name for the parameter to change
PARAMETER="fallback_node"
PARAMETER_NEW_VALUE="http://my_server_name.com/new_path"
A config file may contain :
1°)... (2 Replies)
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data: It's a shell script using a looping logic, trap, tput, if, while. Most of the scripts in this book aren't written... (2 Replies)