I've been tinkering with a shell script to partition and restore content to a drive based on a type of file in a given directory. My goal is for my script to assemble several restore images, partition the drive based on the images and to then restore those images to the partitions on the drive. Its going to be a multi-boot drive for troubleshooting different systems. Everything is going fine so long as the path to my "configuration" directory does not contain whitespaces.
Here is a snippet:
The result is unusable:
I've tried single and double quoting all over the place and I can't find the correct usage. All I'm looking for is this:
The "configuration" folder in my actual script is a variable passed on from another call earlier in the script. I know I could use:
but because the "/test folder" is a variable grepped from the output of a function that only gives human readable output, I'm stuck.
Thanks for any help - I've been working on this line of my script for 3 days now and I can't figure it out. I'm always in awe of how well some folks have mastered the command line. Thanks again!
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)
Hi,
I have been trying to remove whitespace from a file using sed. Here is an example of what im trying to do:
www1 = www1
www2 = www2
www3 = www3
and all the way to 300 and i want it to look like:
www1=www1
www2-www2
www3=www3
again upto 300
Any help... (12 Replies)
Hmmm... Bash doesn't parse whitespace with a read.
lev@sys09:~$ read line; echo "$line"
test
test
You can imagine what this does if you're using a shell script to read a list of unknown file names containing unknown spaces.
lev@sys09:~$ read word1 word2; echo "$word1,$word2"
123 456... (2 Replies)
I have a file that I am spliting and parsing, if data starts with an N/n toos it (which works) but I want it to also see if the data is blank and toss it.
What I have does not toss the blank space for dduck????
here is the data file and code I have.....
efudd 7546
bbunny N0542
tdevil... (3 Replies)
I combined 2 files using the paste command. It gave me something like this:
123445 ,AABBNN
22344 ,BBVVMM
I want to remove the whitespace between the end of string 1 and the comma (there is more blank space than my post is showing). Would I... (2 Replies)
I have a single string as below:
Rat run after Cat
i.e. there is a single whitespace after Cat.
This causes my file to fail.
Is there a way I can remove any whitespace at the end of any string.
I tried sed 's/ *//g', but it removes all white space and the above string becomes... (10 Replies)
Hi
Following is an example line.
echo "192.22.22.22 \"33dffwef\" 200 300 dsdsd" | sed "s:\(\ *\ \):\1:"
I want it's output to be
200
However this is not the case. Can you tell me how to do it? I don't want to use AWK for this. Secondly, how can i fetch just 300? Should I use "\2"... (3 Replies)
Hello I am working aon script, that tells me how many users or on the system when i run it.
The script is
#!/bin/bash
w | cut -f 1 -d ' ' |sort -u | wc -l
When ran it shows 16 users including myself and a line of white space.
I was wondering what I need to add to remove my user... (2 Replies)
Hi guys,
I am working with large data sets and often times realize that not all of the columns are aligned correctly (sometimes rows will be shifted). So when I try to do something like:
awk '{ if ($2 > 30 && $5 == $3){print}}' file > output
it won't really work since some of the rows... (2 Replies)
This is my file
.........hostname.............this is hostname
.........alias...................alias name
Remark use dot(.) instead of whitespace B'cuz this forum not allow to use more whitespace.
---------------------------------------
I sperate by whitespace not work.
awk 'BEGIN {FS=" "}... (4 Replies)
Discussion started by: cyberking
4 Replies
LEARN ABOUT DEBIAN
extundelete
EXTUNDELETE(1) General Commands Manual EXTUNDELETE(1)NAME
extundelete - utility to undelete files from an ext3 or ext4 partition.
SYNOPSIS
extundelete [options] device-file...
DESCRIPTION
extundelete is a utility that can recover deleted files from an ext3 or ext4 partition
extundelete uses the information stored in the partition's journal to attempt to recover a file that has been deleted from the partition.
There is no guarantee that any particular file will be able to be undeleted, so always try to have a good backup system in place, or at
least put one in place after recovering your files!
OPTIONS --version
Prints the version number of extundelete.
--help Print a brief usage summary for extundelete.
Partition name
Name of the partition that has deleted files, such as /dev/sda3.
Could also be the file name of a copy of the partition, such as that made with dd.
--superblock
Prints information about the filesystem from the superblock.
--journal --superblock
Prints information about the journal from the journal's superblock.
--inode #
Prints the information from the inode number of the filesystem given, such as "--inode 2".
--block #
Prints the contents of the block, called as "--block 9652".
--restore-file path/to/deleted/file
Attempts to restore the file which was deleted at the given filename, called as "--restore-file dirname/filename".
--restore-inode #
Used to restore inodes by number, called as "--restore-inode 2569".
Also accepts a list of inodes separated by only commas, such as "--restore-inode 2569,5692,6925".
--restore-files filename
Restores a list of files. First, construct a list of files in the same style as would be
used in the --restore-file option, and save it to the file "filename".
Then, this option may be used to attempt to restore those files with a single call to extundelete.
This form also reduces redundancy from multiple calls parsing the journal multiple times.
--output-dir path/to/dump/recovered/files
Restores files in the output dir 'path'.
By default the restored files are created under current directory 'RECOVERED_FILES'
--restore-all
Restores all files possible to undelete to their names before deletion, when possible. Other files are restored to a filename like
"file.NNNN".
--restore-directory path/of/directory
Restores all files possible to link to specified directory to their names before deletion, when possible.
-j journal_dev
Specifies the device that is the external journal of the file system.
-b block_number
Specifies the block number of the backup superblock to be used when opening the file system.
-B block_size
Specifies the block size of the partition to be used when opening the file system.
--before date
Only restore files deleted before the date specified, which should be in the form of the number of seconds since the UNIX epoch.
Use a shell command like
$ date -d "Aug 1 9:02" +%s
to convert a human-readable date to the proper format. The conversion from the number of seconds to a readable format may be found
by using either of the following:
$ date -d@1234567890
$ perl -le "print scalar localtime 1234567890"
--after date
Only restore files deleted after the date specified, which should be in the form of the number of seconds since the UNIX epoch.
See the notes for the --before option for more information.
AUTHOR
extundelete was written by Nic Case <number9652@users.sourceforge.net> Copyright (C) 2009, 2010
This manual page was written by Elias Alejandro Ano Mendoza <ealmdz@gmail.com>, for the Debian project (and may be used by others).
September 29, 2010 EXTUNDELETE(1)