hi,
can anyone guide me
if the line, last character contains number then it should be appended with that line,if not the output should be same
can anyone provide using awk,sed.
input.txt:
satish 56788 /opt/product/BETA/lsmpp_install/bin/startBETAsmpp 2
satish 76899 /opt/product/BETA/lsmpp_install/bin/startBETAsmsc a
output should be:
satish 56788 /opt/product/BETA/lsmpp_install/bin/startBETAsmpp2
satish 76899 /opt/product/BETA/lsmpp_install/bin/startBETAsmsc a
thanks in advance
Need to add last character if is it numeric
Moderator: DosItHelp
Re: Need to add last character if is it numeric
This is primarily a Windows based scripting language forum. Do not expect a solution with Unix based tools that have been ported to Windows. Looks like you are using Unix or Linux based on your folder paths.
Please give better example of your input and output. Currently it looks the same to me.
Please give better example of your input and output. Currently it looks the same to me.
Re: Need to add last character if is it numeric
The question is phrased awkwardly - the OP wants to remove a space if the last character is a numeral.
This works with the sample data:
This uses a helper batch file called `repl.bat` (by dbenham) - download from: https://www.dropbox.com/s/qidqwztmetbvklt/repl.bat
Place `repl.bat` in the same folder as the batch file or in a folder that is on the path.
This works with the sample data:
Code: Select all
type "input.txt"|repl "(.*) ([0-9])$" "$1$2"
This uses a helper batch file called `repl.bat` (by dbenham) - download from: https://www.dropbox.com/s/qidqwztmetbvklt/repl.bat
Place `repl.bat` in the same folder as the batch file or in a folder that is on the path.
Re: Need to add last character if is it numeric
foxidrive wrote:The question is phrased awkwardly - the OP wants to remove a space if the last character is a numeral.
Glad you understood. Would have been a lot easier to say "remove the space before the number"!
Re: Need to add last character if is it numeric
Yes thanks for the solution in DOS, i just had doubt in unix so posted
I knew few people here in this forum agermnan and ghostmachine who used to solve in dos and awk.
I knew few people here in this forum agermnan and ghostmachine who used to solve in dos and awk.