Sponsored Content
Full Discussion: Trim a new line
Top Forums Shell Programming and Scripting Trim a new line Post 302458980 by Scrutinizer on Sunday 3rd of October 2010 04:14:34 AM
Old 10-03-2010
Try:
Code:
host example.com | awk 'NR==1{printf $NF}'

This User Gave Thanks to Scrutinizer For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

trim whitespace?

I'm trying to find a command that will trim the white space off a string. e.g. $str = " stuf " $str = trim ( $str ) echo $str // ouput would just be stuf Thanks, Mark (4 Replies)
Discussion started by: msteudel
4 Replies

2. Shell Programming and Scripting

Trim trailing spaces from each line in a file

Hello folks, Is there a simple way to trim trailing spaces from each line a file. Please let me know. Regards, Tipsy. (5 Replies)
Discussion started by: tipsy
5 Replies

3. Shell Programming and Scripting

Trim whitespace and add line break

All, I'm a newbie at shell scripting and regular expressions and I just need to take a file that's arranged like the one below, remove all leading and trailing whitespace and add a line break after each word. I've been able to remove a few spaces using various awk, sed and Perl scripts, but... (7 Replies)
Discussion started by: moose1
7 Replies

4. Shell Programming and Scripting

To Trim spaces at the end of line

Hi Friends, Can any one help with this issue: How to trim spaces for each line at the end, Like I have a file in this format. EMP1 SMITH 46373 5 STREET HOWARD 74636 EMP2 JONES 5454 { these are spaces ........} EMP3 SMITH 46373 5 STREET HOWARD 74636 EMP4 JON 2554 { these are... (1 Reply)
Discussion started by: sbasetty
1 Replies

5. Shell Programming and Scripting

Trim

Hello, I am passing a filename to a script to draw parameters from it. However, I want to use part of the filename as a parameter. The filename is transfer_ccf_3731_10.sh but I only need the 3731_10 part of it. Is this possible? Any help or suggestions would be appreciated! Regards, J. (4 Replies)
Discussion started by: JWilliams
4 Replies

6. Shell Programming and Scripting

Trim issue

Hi All, I am using trim in my code.. ID_SA_SOURCE="`echo "$data" | cut -c17-34 | tr -s " "`" ID_SA_DEST="`echo "$data" | cut -c35-52 | tr -s " "`" echo"$ID_SA_SOURCE";"$ID_SA_DEST"; the output is 0608166896; 3001339; contains one whitespace between the two ..how can i remove that single... (3 Replies)
Discussion started by: scorpio
3 Replies

7. Shell Programming and Scripting

another trim question using tr

Hi all, I've been looking for how to eliminate blank spaces in a variable or strings. I've seen several ways, using sed, awk and even python. One of them is use 'tr' command, but it does not work as I expected: For example: echo " stuff " | tr -s " "leaves one space ahead and another... (3 Replies)
Discussion started by: AlbertGM
3 Replies

8. Shell Programming and Scripting

To trim Certain field in a line of a file and replace the new string in that position

To trim 3rd field in for all the lines of a file and replace the modified string in that particular field. For example i have a file called Temp.txt having content Temp.txt ----------------- 100,234,M1234 400,234,K1734 300,345,T3456 ---------------- So the modified file output should... (4 Replies)
Discussion started by: rpadhi
4 Replies

9. Shell Programming and Scripting

get the fifth line of a text file into a shell script and trim the line to extract a WORD

FOLKS , i have a text file that is generated automatically of an another korn shell script, i want to bring in the fifth line of the text file in to my korn shell script and look for a particular word in the line . Can you all share some thoughts on this one. thanks... Venu (3 Replies)
Discussion started by: venu
3 Replies

10. Shell Programming and Scripting

Trim Filename

Hi All, I have a file named as FAB1_600015_CONRAD.A0_7XYZ12345.000_LT-SWET.01_LTPA25L_20110622-161429_07_WFR12345_20110622-161429_20110712-125228.data.dis I want to generate a directory taking only the 7XYZ12345.000_WFR12345 The length and format of the Filename will be the same... (2 Replies)
Discussion started by: asheshrocky
2 Replies
auto_parms(1M)															    auto_parms(1M)

NAME
auto_parms - initial system configuration plus DHCP support command SYNOPSIS
DESCRIPTION
The command is a system initialization command that handles first-boot configuration, that is, the setting of unique system "initial iden- tity parameters", and ongoing management of DHCP lease(s). The command is invoked at boot time by the command. Initially it loads a list of available ethernet interfaces and requests a DHCP lease on each interface. See the rc(1M) manpage for information about for invocation context. While checking for availability of a lease on each interface, also consults and examines the variable If it is set to "1", attempts to request a lease on the the interface designated by If is set to "0" (the default case) or is absent from does not attempt a DHCP request on that interface. Once a lease is secured, the information supplied with the lease is used to initialize key networking parameters; see dhcpdb2conf(1M). If detects that the system is undergoing "first-boot" (meaning the system's hostname is not yet set), it invokes to verify the DHCP-sup- plied parameters and to collect any parameters not supplied by DHCP. For all subsequent boots, the data supplied by a DHCP lease is assumed by to be correct. Note that in a (non-mobile) environment where DHCP is used for IP address management, under normal conditions the lease information should not change between reboots. This is accom- plished by placing in "lease maintenance mode" prior to exiting. FILES
The command itself. Common subroutines used by and sub-area commands. Log files written and saved by AUTHOR The command was developed by HP. SEE ALSO
dhcpdb2conf(1M), rc(1M), set_parms(1M). auto_parms(1M)
All times are GMT -4. The time now is 02:01 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy