- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Deleting a space in a line during a for ...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-28-2009 04:02 PM
тАО10-28-2009 04:02 PM
this is my program..
for x in `cat temp1.${a}`
do
echo "this is the line $x"
done
this is the file temp1.${a}:
=======================
Daniela Miranda
PedroRamirez Lopez
ArturoLimaper
=======================
how can i delete the space when i am taking the line during the for:
for x in `cat temp1.${a}`
i need it be showed the line with no spaces as:
.....................
DanielaMiranda
PedroRamirezLopez
ArturoLimaper
.....................
please let me know.
Thanks in advance.
Manuales.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-28-2009 04:14 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-28-2009 04:17 PM
тАО10-28-2009 04:17 PM
Re: Deleting a space in a line during a for ...
=======================
Daniela_Miranda
PedroRamirez_Lopez
Arturo_Limaper
=======================
instud of space i will look for _ in script to delete
Hope this Helps
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-28-2009 04:22 PM
тАО10-28-2009 04:22 PM
Re: Deleting a space in a line during a for ...
Try this:
for x in `cat temp1.${a}| tr -d " "`
do
....
Cheers,
Raj.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-29-2009 01:51 AM
тАО10-29-2009 01:51 AM
Re: Deleting a space in a line during a for ...
If you want to do other changes, you can modify JRF's solution to use sed(1):
while read LINE; do
X=$(echo ${LINE} | sed -e 's/ //g')
echo "this is the line: ${X}"
done < temp1/${a}
Or change Raj's to remove that evil cat:
for x in $(tr -d " " < temp1.${a}); do
Note if there are other whitespaces in the lines, each $x will not contain the whole line.
- Tags:
- evil cat
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-29-2009 02:19 AM
тАО10-29-2009 02:19 AM
Re: Deleting a space in a line during a for ...
(0 or 1 pts. only pls. )
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-29-2009 09:44 AM
тАО10-29-2009 09:44 AM
Re: Deleting a space in a line during a for ...
this worked:
for x in `cat temp1.${a}| tr -d " "`
the other examples also worked ..
thank you so much.